我已经编写了一些代码来通过 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();
}
异常(exception)情况:
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 整数 HelpLink 空字符串 InnerException null 系统异常 消息“值不能为空。\r\n参数名称:源”字符串 ServerErrorCode -2147467261 整数 ServerErrorDetails 空对象 ServerErrorTraceCorrelationId "3a3ef99d-702c-3000-d2be-2391dc283133"字符串 ServerErrorTypeName "System.ArgumentNullException"字符串 ServerErrorValue 空字符串 ServerStackTrace“”字符串 源“Microsoft.SharePoint.Client.Runtime”字符串 StackTrace“在 Microsoft.SharePoint.Client.ClientRequest.ProcessResponseStream(流响应流)\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() 中....\ConsoleApplication1\Program.cs:line 79"string
请帮我找出这个异常是什么以及如何解决它。
非常感谢和最诚挚的问候,
大卫
最佳答案
我们昨天遇到了同样的问题,并进行了大量研究来调查错误。但这只是我们的租户有问题。尝试在不同的租户上开始创建站点,看看是否可行。如果 SharePoint 存在一些问题,还可以查看租户“Admin Portal => Service health”。
希望能为您节省一些时间。
关于c# - 使用 CSOM C# 创建网站集时出现错误值不能为空。参数名称 : source,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44411250/