我查看了stackoverflow上的一些帖子以及网络上的其他一些文章
这指出上下文似乎正在使用IUSR:
http://blogs.msdn.com/b/sridhara/archive/2014/02/06/sharepoint-2013-csom-call-from-web-part-fails-with-401-for-all-users.aspx
这个提到尝试设置默认网络凭据:
https://sharepoint.stackexchange.com/questions/10364/http-401-unauthorized-using-the-managed-client-object-model
我已经尝试使用文章中提到的修复程序以及尝试强制上下文使用DefaultNetworkCredentials但没有运气.我想让应用程序使用登录用户的凭据而不是机器…
这是我正在使用的代码:
SP.ClientContext context = new SP.ClientContext("MySPDevInstance"); context.Credentials = CredentialCache.DefaultNetworkCredentials; Entity entity = context.Web.GetEntity(collectionNamespace,collectionName); LobSystem lobSystem = entity.GetLobSystem(); LobSystemInstanceCollection lobSystemInstanceCollection = lobSystem.GetLobSystemInstances(); context.Load(lobSystemInstanceCollection); context.ExecuteQuery(); LobSystemInstance lobSystemInstance = lobSystemInstanceCollection[0]; FilterCollection filterCollection = entity.GetFilters(filter); filterCollection.SetFilterValue("LimitFilter",1000); EntityInstanceCollection items = entity.FindFiltered(filterCollection,filter,lobSystemInstance);
服务器正在运行IIS 6.0
任何建议将不胜感激!
谢谢
解决方法
如果您确实需要用户的身份来访问SharePoint数据而您无法更改身份验证方案,那么最好的方法是使用JavaScript CSOM.这意味着用户直接对SharePoint服务器进行身份验证(单跳,而不是双重),并且ASP.NET站点向用户提供包含此脚本的页面.
(1)http://blogs.msdn.com/b/knowledgecast/archive/2007/01/31/the-double-hop-problem.aspx
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。