sharepoint - SPListItem.Properties DateTime 字段采用奇怪的十六进制格式

标签 sharepoint

有谁知道如何将这些字符串十六进制值转换回 DateTime 值?

属性 my_DateProperty (System.String) = 0x01c9874e|0x98f28800

//l_item is SPListItem          
Hashtable l_properties = l_item.Properties;
if (l_properties != null)
{
    object l_value = null;
    foreach (string l_key in l_properties.Keys)
    {
        l_value = l_properties[l_key];
        Splogger.log("Property " + l_key + " (" + l_value.GetType().ToString() + ") = " + l_value.ToString());
    }
}

最佳答案

我最近发现这似乎只发生在 Office 2007 文档上(对于其他文件类型,该值是日期的标准字符串格式)。答案是十六进制值表示自 1/1/1600 以来的刻度数。这是对我有用的转换:

Dim dateVal as DateTime = New DateTime(Long.Parse(dateText.Replace("0x", "").Replace("|", ""), System.Globalization.NumberStyles.HexNumber)).AddYears(1600) )

关于sharepoint - SPListItem.Properties DateTime 字段采用奇怪的十六进制格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/521078/

相关文章:

Javascript 和 SharePoint 2013 : Set background color to list item

c# - 如何使用应用程序级身份验证/访问 token 访问 Sharepoint 文件?

javascript - 如何将参数传递给 onQuerySucceeded 函数

sharepoint - 从支持 SSL 的 SharePoint 站点打开文件

c# - linq 查询仅在包含 "Object reference not set to an instance of an object"时失败

python - 从 Sharepoint rest api 下载文件时出现 400 错误

c# - 无法部署新的 SharePoint 网站模板程序集版本

c# - 如何以编程方式将事件接收器附加到 SPList?

sharepoint - 配置 GTM 以在页面加载后在页面 View 上设置字段

SharePoint 内容查询 Web 部件 - 忽略当前级别