我将通过此处的示例展示如何使用SharePoint 2013 .NET Framework客户端对象模型(CSOM)执行基本操作。
https://msdn.microsoft.com/en-us/library/office/fp179912.aspx 我的问题是为什么在我可以在CSOM中执行查询之前我不需要对用户进行身份验证
例如
// Starting with ClientContext, the constructor requires a URL to the
// server running SharePoint.
ClientContext context = new ClientContext("http://SiteUrl");
// The SharePoint web at the URL.
Web web = context.Web;
// We want to retrieve the web's properties.
context.Load(web);
// Execute the query to the server.
context.ExecuteQuery();
// Now, the web's properties are available and we could display
// web properties, such as title.
label1.Text = web.Title;
答案 0 :(得分:0)
您不需要这样做,因为它将使用当前登录的用户。否则你必须先冒充用户。
ClientContext context = new ClientContext("http://server/");
context.Credentials = new NetworkCredential("user", "password", "domain");
// Some Cording
context.ExecuteQuery();