我试图拉一些我创建的SharePoint 2013列表数据,在我的机器上本地运行时以及在本地运行一台服务器时工作正常。在用户本地和本地服务器上运行时,我都拥有相同的凭据。问题是当我发布并导航到服务器上的ASP.NET应用程序时,我得到“远程服务器返回错误:(401)未经授权。”错误...远程服务器返回错误:(401)未经授权。在ASP.NET中使用CSOMA
我看了一堆计算器上的帖子和其他一些物品网页
此指出的背景似乎是使用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", 0, 1000);
EntityInstanceCollection items = entity.FindFiltered(filterCollection, filter, lobSystemInstance);
服务器正在运行IIS 6.0
任何意见将不胜感激!
谢谢
您是否知道如何从LOB获取所有实体而不应用过滤器? http://sharepoint.stackexchange.com/questions/97155/sharepoint-2013-bcs-external-data-column – monkeyjumps