如何以编程方式使用pnp csom删除SharePoint网站集
我需要SharePoint Online Office 365。根据我的要求,我必须以编程方式使用pnp csom从SharePoint Online Office 365管理中心删除所有网站集如何以编程方式使用pnp csom删除SharePoint网站集,sharepoint,csom,Sharepoint,Csom,我需要SharePoint Online Office 365。根据我的要求,我必须以编程方式使用pnp csom从SharePoint Online Office 365管理中心删除所有网站集 任何人都可以建议如何删除所有网站集?使用全局管理员帐户连接到SharePoint Online: Connect-PnPOnline https://tenant-admin.sharepoint.com 按url删除特定网站集: Remove-PnPTenantSite -Url https:/
任何人都可以建议如何删除所有网站集?使用全局管理员帐户连接到SharePoint Online:
Connect-PnPOnline https://tenant-admin.sharepoint.com
按url删除特定网站集:
Remove-PnPTenantSite -Url https://tenant.sharepoint.com/sites/sitename-Force -SkipRecycleBin
您可以使用
删除网站集
扩展方法删除网站集
可按如下方式使用:
string userName = "admin@tenant.onmicrosoft.com";
string password = "password";
string siteUrl = "https://tenant-admin.sharepoint.com/";
using (ClientContext clientContext = new ClientContext(siteUrl))
{
SecureString securePassword = new SecureString();
foreach (char c in password.ToCharArray())
{
securePassword.AppendChar(c);
}
clientContext.AuthenticationMode = ClientAuthenticationMode.Default;
clientContext.Credentials = new SharePointOnlineCredentials(userName, securePassword);
var tenant = new Tenant(clientContext);
// use false, if you want to keep site collection in recycle bin
tenant.DeleteSiteCollection("https://tenant.sharepoint.com/sites/Test", true);
}