【发布时间】:2018-02-02 06:12:08
【问题描述】:
我想在根级别创建新站点(而不是现有站点中的子站点)。我正在使用 CSOM 创建网站。在当前场景中,我需要向客户端上下文提供站点 URL 以进行身份验证并执行操作。这是一个伪代码。
string url = "https://mysharepoint.com/sites/testsite";
SecureString f_SecurePass = new SecureString();
foreach (char ch in pass)
f_SecurePass.AppendChar(ch);
clientcontext = new ClientContext(url);
var credentials = new SharePointOnlineCredentials(userid, f_SecurePass);
clientcontext.Credentials = credentials;
Web web = clientcontext.Web;
clientcontext.Load(web, website => website.Lists);
clientcontext.ExecuteQuery();
WebCreationInformation wci = new WebCreationInformation();
wci.Url = "/TestAPISite2";
wci.Title = "TestAPISite2";
wci.Language = 1033;
var newsite = clientcontext.Site.RootWeb.Webs.Add(wci);
clientcontext.ExecuteQuery();
请提出解决方案。
【问题讨论】:
标签: sharepoint sharepoint-online csom