using (ClientContext context = SharePointManager.ConnectTo(site))
{
var spTimeZone = context.Web.RegionalSettings;
context.Load(spTimeZone);
}
如下所示的错误消息:
“字段或属性\”RegionalSettings \“不存在
仔细检查SharePoint网站,区域设置是UTC +8。我错过了什么吗?
答案 0 :(得分:1)
由于您对SharePoint 2010 使用SharePoint Server 2013 Client Components SDK或SharePoint 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;
}