1
我需要以編程方式從Office 365中的應用程序中創建新的網站集。我的意思是一個新的網站集,是在創建後,它應該出現在Office 365的管理 - > Sharepoint選項卡下的網站集列表中。我嘗試在一個共享點託管的應用程序中使用下面的類似代碼,從APP中創建Office 365中的新網站集
//create sp context and get root
var clientContext = new SP.ClientContext.get_current();
var rootWeb = clientContext.site.rootWeb();
this.clientContext.load(rootWeb);
this.clientContext.executeQUery();
//set web info
var webInfo = new SP.WebCreationInformation();
webInfo.set_webTemplate('YourTemplateName');
webInfo.set_description('Your site description');
webInfo.set_title('Your site tittle');
webInfo.set_url(siteUrl);
webInfo.set_language(yourLangCode);
this.rootWeb.get_webs().add(webInfo);
this.rootWeb.update();
// save site and set callbacks
this.clientContext.load(this.rootWeb);
this.clientContext.executeQueryAsync(
Function.createDelegate(this, this.OnSiteCreationSuccess),
Function.createDelegate(this, this.Error));
但是,這只是在承載我的應用程序的網站集下創建一個子網站。
關於如何實現這一點的任何建議將不勝感激。
非常感謝馬特。這正是我所期待的。它令人難以置信的是,如何獲得文檔。你知道是否有可能以編程方式爲用戶或組分配權限給創建的新網站集? – RAHUL
我認爲這是可能的,因爲它已經在powershell命令中:http://technet.microsoft.com/en-us/library/fp161371(v = office.15)。它應該與這個類donw:http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.client.user.aspx。但我沒有這方面的例子。 – Matt