首页 文章

身份验证SharePoint 2013本地REST API

提问于
浏览
0

我有一个带有列表的本地SharePoint 2013 . 我需要远程使用REST API从客户端应用程序(而不是Office / Sharepoint“App”)获取该列表 . 我不知道如何对SharePoint进行身份验证 . 我不想使用访问令牌或基于表单的身份验证 . 安全证书不起作用,因为它不是“SharePoint应用程序” . 有人能帮助我吗?谢谢 .

1 回答

  • 0

    我发现了解决方案,事实证明它非常简单 .

    string url = "http://<siteUrl>/_api/web/lists";
     HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(url);
     webRequest.AuthenticationLevel = System.Net.Security.AuthenticationLevel.MutualAuthRequested;
     webRequest.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;
     webRequest.Method = "GET";
     Stream response = webRequest.GetResponse().GetResponseStream();
     StreamReader reader = new StreamReader(response);
    

    该代码会显示您的网站包含的任何列表,并将结果放入流阅读器中 . 事实证明这很简单,我一直在寻找太复杂的东西 . 希望它可以帮到某人!

相关问题