【问题标题】:SharePoint client object model returns "User Cannot Be Found" on clientContext.ExecuteQuery() methodSharePoint 客户端对象模型在 clientContext.ExecuteQuery() 方法上返回“找不到用户”
【发布时间】:2016-05-26 06:47:47
【问题描述】:

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;
        }

我提供了有效的凭据,甚至可以通过浏览器使用提供的相同凭据访问 SharePoint 网站,而不会出现任何问题。

以前有人遇到过这个问题吗?

环境: MVC 5 应用程序。 CSOM。 视觉工作室。 C#

【问题讨论】:

    标签: model-view-controller office365 csom


    【解决方案1】:

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

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

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

    感谢您的回答。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-04-08
      • 1970-01-01
      • 2011-03-04
      • 1970-01-01
      相关资源
      最近更新 更多