Model view controller SharePoint客户端对象模型返回“;“找不到用户”;在clientContext.ExecuteQuery()方法上

Model view controller SharePoint客户端对象模型返回“;“找不到用户”;在clientContext.ExecuteQuery()方法上,model-view-controller,office365,csom,Model View Controller,Office365,Csom,SharePoint客户端对象模型在clientContext.ExecureQuery()方法上返回“找不到用户”,下面是示例代码 ListItemCollection listItemColl = null; var securePassword = new System.Security.SecureString(); var pwd = WebConfigurationManager.AppSettings["password"];

SharePoint客户端对象模型在clientContext.ExecureQuery()方法上返回“找不到用户”,下面是示例代码

        ListItemCollection listItemColl = null;
        var securePassword = new System.Security.SecureString();
        var pwd = WebConfigurationManager.AppSettings["password"];

        foreach (char c in pwd)
        {
            securePassword.AppendChar(c);
        }

        var spUri = ConfigurationManager.AppSettings["Office365SharepointUri"];
        var clientContext = new ClientContext(new Uri(spUri));
        var onlineCredentials = new SharePointOnlineCredentials(WebConfigurationManager.AppSettings["userName"], securePassword);

        clientContext.Credentials = onlineCredentials;

        try
        {
            var strCamlQuery = new CamlQuery();                
            clientContext.Load(clientContext.Web);                
            var templist = clientContext.Web.Lists.GetByTitle("SomeValidListName");
            clientContext.Load(templist);                
            strCamlQuery.ViewXml = "<View Scope=\"RecursiveAll\"></View>";
            listItemColl = templist.GetItems(strCamlQuery);
            clientContext.Load(listItemColl);
            clientContext.ExecuteQuery();
        }
        catch (Exception)
        {
            throw;
        }
ListItemCollection listItemColl=null;
var securePassword=new System.Security.SecureString();
var pwd=WebConfigurationManager.AppSettings[“密码”];
foreach(pwd中的字符c)
{
securePassword.AppendChar(c);
}
var spUri=ConfigurationManager.AppSettings[“Office365SharepointUri”];
var clientContext=newclientcontext(newuri(spUri));
var onlineCredentials=新的SharePointOnlineCredentials(WebConfiguration Manager.AppSettings[“用户名”],securePassword);
clientContext.Credentials=联机凭据;
尝试
{
var strCamlQuery=new CamlQuery();
Load(clientContext.Web);
var templast=clientContext.Web.Lists.GetByTitle(“SomeValidListName”);
加载(模板列表);
strcmlquery.ViewXml=“”;
listItemColl=templast.GetItems(strCamlQuery);
Load(listItemColl);
clientContext.ExecuteQuery();
}
捕获(例外)
{
投掷;
}
我提供了有效的凭据,甚至可以通过浏览器使用提供的相同凭据访问SharePoint网站,而不会出现任何问题

以前有人面对过这个问题吗

环境: MVC5应用程序。 CSOM。 Visual Studio。
C#

这是SharePoint中的Bug,我与SharePoint高级支持人员进行了交谈

如果创建这些列表的用户被完全删除,当您尝试访问这些列表时,CSOM会抛出“找不到用户”异常,SP会在内部检查创建列表的用户

解决方案是使用不同的用户重新创建这些列表。希望SP团队解决这个问题

谢谢你的回答