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.siteprope...
May 19, 2017
Hi Michael Schau,
I just tried this with PnP PowerShell/CSOM and I'm finding the same results as you.
I had a bit of a further play with this where I tried setting NewUrl to ServerRelativeUrls or just setting it to the site specific part of the Url but this gave me just different errors. I would expect that as you can only update the site specific bit that you might not include the full url, but unfortenately that didn't work.
I thnk you might be right that this only works in on premises environments.
Deleted
May 19, 2017have you read this?
public property Microsoft.Online.SharePoint.TenantAdministration.SiteProperties.NewUrl - The new URL for the site (updating this will trigger a site rename). Notice. This is not yet functional in the production when this blog post was written
https://dev.office.com/blogs/new-sharepoint-csom-version-released-for-Office-365-march-2016
- DeletedMay 19, 2017
Just checked with reflector code is implemented but can not debug it :-(
- Michael SchauMay 19, 2017Copper Contributor
Yep, I've read it.
But as mentioned it was posted more than a year ago. Just assumed that it was funtioning in "Production" by now.
- May 19, 2017
Hi Deleted,
I tried this:
$site = Get-PnPTenantSite https://Mytenant.sharepoint.com/sites/testsite
$site.NewUrl = "https://Mytenant.sharepoint.com/sites/testsite2"
$site.Update()
$site.Context.ExecuteQuery()
and then I tried all variations of Urls for the $site.NewUrl = ""