class Program
{
public static CookieContainer cc { get; set; }
static void Main(string[] args)
{
string SharePointUrl = "http://pekwncowo01:88";
fbauth.Authentication auth = new fbauth.Authentication();
auth.Url = SharePointUrl + "/_vti_bin/authentication.asmx";
auth.CookieContainer = new System.Net.CookieContainer();
auth.AllowAutoRedirect = true;
fbauth.LoginResult lr = auth.Login("libx4", "Password.1");

 

if (lr.ErrorCode == fbauth.LoginErrorCode.NoError)
{
cc = auth.CookieContainer;
}


HttpWebRequest endpointRequest = (HttpWebRequest)HttpWebRequest.Create(SharePointUrl + "/_api/web/title");
endpointRequest.Method = "GET";
endpointRequest.Accept = "application/json;odata=verbose";
endpointRequest.CookieContainer = cc;

WebResponse res = endpointRequest.GetResponse();

StreamReader sr = new StreamReader(res.GetResponseStream());

string ddd = sr.ReadToEnd();

Console.WriteLine(ddd);
Console.ReadLine();
}

相关文章:

  • 2021-11-09
  • 2021-07-14
  • 2021-05-17
  • 2021-10-31
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-04-07
  • 2021-06-11
  • 2022-02-23
  • 2021-12-10
  • 2022-12-23
  • 2022-12-23
  • 2021-10-16
相关资源
相似解决方案