无法加载RegionalSettings字段/属性Sharepoint CSOM

时间:2014-12-30 06:31:32

标签: c# winforms sharepoint csom

using (ClientContext context = SharePointManager.ConnectTo(site))
{
    var spTimeZone = context.Web.RegionalSettings;
    context.Load(spTimeZone);
}

如下所示的错误消息:

  

“字段或属性\”RegionalSettings \“不存在

仔细检查SharePoint网站,区域设置是UTC +8。我错过了什么吗?

1 个答案:

答案 0 :(得分:1)

由于您对SharePoint 2010 使用SharePoint Server 2013 Client Components SDKSharePoint Online Client Components SDK,因此很可能会发生此错误。

Web class在SharePoint 2010 CSOM中公开RegionalSettings属性。

总而言之,似乎无法使用SharePoint 2010 CSOM检索区域设置,因为Web类不会公开RegionalSettings属性。

如何确定CSOM SDK程序集版本?

Assembly assembly = Assembly.GetAssembly(typeof(ClientContext));
FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(assembly.Location);
string version = fvi.FileVersion;

如何通过CSOM确定SharePoint版本?

using (var ctx = new ClientContext(webUrl))
{
    ctx.ExecuteQuery();
    var version = ctx.ServerLibraryVersion;
}