简体   繁体   English

使用c#登录到SharePoint 2013

[英]login to the SharePoint 2013 using c#

Is their any way to login to the SharePoint 2013 using c# code and get the token of sharepoint 2013, if yes then how can i do? 他们有使用c#代码登录到SharePoint 2013并获取sharepoint 2013令牌的任何方法吗,如果可以,我该怎么办? means user will put username and password from the client side and auth is window auth configured on sharepoint 2013 in my case also please specify the SharePoint 2013 config also 意味着用户将在客户端输入用户名和密码,并且在我的情况下,auth是在sharepoint 2013上配置的窗口身份验证,也请同时指定SharePoint 2013配置

Now created a api in mvc and it's working with netwrokcredential class which is available in c# but i am not getting the token for the sharepoint 现在在mvc中创建了一个api,它正在与netwrokcredential类一起使用,该类在c#中可用,但是我没有获得共享点的令牌

You can use client side object model to create context with your credentials. 您可以使用客户端对象模型来创建具有凭据的上下文。

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();
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM