我正在.NET Web應用程序中工作。我嘗試連接到Sharepoint Online Premise以通過使用HTTPClient和Sharepoint 2013來獲取「文檔庫」中的文檔REST API。使用HTTPClient和Sharepoint 2013 REST API獲取文檔
我在瀏覽器中的這個測試以下REST服務,
https://site_url/_vti_bin/ListData.svc/Documents
這給所有在場的特定網站的文檔庫中的文件的元數據。
現在,當我試圖通過向服務的URL的引用,通過使用下面的代碼編程方式做同樣的,
TestSiteDataContext ctx = new TestSiteDataContext(new Uri("https://site url/_vti_bin/ListData.svc"));
ctx.Credentials = new NetworkCredential("[email protected]", "test");
var data = ctx.Documents.ToList();
我收到以下異常: 「請求已中止:無法創建SSL/TLS安全通道。「 堆棧跟蹤如下:
at System.Net.HttpWebRequest.GetResponse()
at System.Data.Services.Client.QueryResult.Execute()
at System.Data.Services.Client.DataServiceRequest.Execute[TElement](DataServiceContext context, QueryComponents queryComponents)
at System.Data.Services.Client.DataServiceQuery`1.Execute()
at System.Data.Services.Client.DataServiceQuery`1.GetEnumerator()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at SPO_AccessAWebService.Program.Main(String[] args) in Location\Program.cs:line 35
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
我已經通過各種articles/blogs找到this.Bust解決找不到任何。 我能看到各種樣品THA節目藉助驗證,
ctx.Credentials = CredentialCache.DefaultNetworkCredentials;
這也拋出了同樣的錯誤。
是否有任何其他方式來驗證SharePoint 2013 REST API?
有人可以提供一些見解來解決這個問題嗎?