Forum Discussion
Michael Schau
May 18, 2017Copper Contributor
SiteProperties.NewUrl not working
Has anyone had any luck changing the SiteCollection url in SharePoint Online using CSOM?
https://msdn.microsoft.com/en-us/library/office/microsoft.online.sharepoint.tenantadministration.siteproperties.newurl.aspx
Here's a code sample (using OfficedDevPnP extensions)
var tenant = new Tenant(context);
var siteProperties = tenant.GetSitePropertiesByUrl("<CurrentUrl>", false);
tenant.Context.Load(siteProperties);
tenant.Context.ExecuteQueryRetry();
siteProperties.NewUrl = "<NewUrl>";
siteProperties.Update();
tenant.Context.ExecuteQueryRetry();I get an ArgumentException with the following message
The requested operation is not supported for site: <SiteUrl>
13 Replies
- Anonymous
what is the context when you add
var tenant=tenant(context) ??
- Michael SchauCopper Contributor
It is the Tenant Admin context.
Eg. <myurl>-admin.sharepoint.com
Is this something new? So far this has not been supported...adding VesaJuvonen to comment on this