我試圖拉一些我創建的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