【发布时间】:2017-11-08 17:23:03
【问题描述】:
我编写了一些代码来通过 CSOM C# 创建网站集,以下代码运行良好。但最近(1、2 天前),它给了我“ServerException Value cannot be null.\r\nParameter name: source”,从那时起我无法再创建任何站点。
using (var tenantContext = new ClientContext("https://<Tenant>-admin.sharepoint.com"))
{
var password = ConvertToSecureString("my admin password");
tenantContext.Credentials = new SharePointOnlineCredentials("my admin account", password);
var tenant = new Tenant(tenantContext);
var siteCreationProperties = new SiteCreationProperties();
siteCreationProperties.Title = "Site 01";
siteCreationProperties.Url = "https://<Tenant>.sharepoint.com/sites/site01";
siteCreationProperties.Owner = "my admin account";
var spo = tenant.CreateSite(siteCreationProperties);
tenantContext.Load(spo, i => i.IsComplete);
tenantContext.ExecuteQuery();
}
还有例外:
ex {"Value cannot be null.\r\nParameter name: source"} System.Exception
{Microsoft.SharePoint.Client.ServerException} 数据 {System.Collections.ListDictionaryInternal} System.Collections.IDictionary {System.Collections.ListDictionaryInternal} HResult -2146233088 int 帮助链接空字符串 内部异常 null System.Exception 消息“值不能为空。\r\n参数名称:源”字符串 ServerErrorCode -2147467261 int ServerErrorDetails 空对象 ServerErrorTraceCorrelationId "3a3ef99d-702c-3000-d2be-2391dc283133" 字符串 ServerErrorTypeName "System.ArgumentNullException" 字符串 ServerErrorValue 空字符串 ServerStackTrace "" 字符串 源“Microsoft.SharePoint.Client.Runtime”字符串 StackTrace " 在 Microsoft.SharePoint.Client.ClientRequest.ProcessResponseStream(Stream responseStream)\r\n 在 Microsoft.SharePoint.Client.ClientRequest.ProcessResponse()\r\n 在 Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryToServer(ChunkStringBuilder sb) \r\n 在 Microsoft.SharePoint.Client.ClientRequest.ExecuteQuery()\r\n 在 Microsoft.SharePoint.Client.ClientRuntimeContext.ExecuteQuery()\r\n 在 Microsoft.SharePoint.Client.ClientContext.ExecuteQuery()\r \n 在 ConsoleApplication1.Program.CreateSite() in....\ConsoleApplication1\Program.cs:line 79" 字符串
请帮我找出这个异常是什么以及如何解决它。
非常感谢和最好的问候,
大卫
【问题讨论】:
标签: c# office365 sharepoint-online