使用c#登录SharePoint 2013

本文关键字:2013 SharePoint 登录 使用 | 更新日期: 2023-09-27 18:01:13

他们有没有办法使用c#代码登录SharePoint 2013并获得SharePoint 2013的令牌,如果有,我该怎么办?意味着用户将从客户端输入用户名和密码,在我的情况下,auth是在sharepoint 2013上配置的窗口auth还请指定SharePoint 2013配置以及

现在在mvc中创建了一个api,它正在使用c#中提供的netwrokcredential类,但我没有获得sharepoint 的令牌

使用c#登录SharePoint 2013

您可以使用客户端对象模型来创建带有凭据的上下文。

using (ClientContext context = new ClientContext("http://site_url/"))
{
    context.Credentials = new NetworkCredential("user_login", "user_password", "DOMAIN");
    List list = context.Web.Lists.GetByTitle("My list");
    context.Load(list);
    context.ExecuteQuery();
    Console.WriteLine(list.Id);
    Console.ReadKey();
}