SiteProperties.NewUrl not working

Copper Contributor

Has anyone had any luck changing the SiteCollection url in SharePoint Online using CSOM?


Here's a code sample (using OfficedDevPnP extensions) 

var tenant = new Tenant(context);

var siteProperties = tenant.GetSitePropertiesByUrl("<CurrentUrl>", false);

siteProperties.NewUrl = "<NewUrl>";


I get an ArgumentException with the following message

The requested operation is not supported for site: <SiteUrl>

13 Replies

what is the context when you add

var tenant=tenant(context) ??

It is the Tenant Admin context.

Eg. <myurl>

Is this something new? So far this has not been supported...adding @Vesa Juvonen to comment on this

Well, it was added to CSOM a year ago, so I just assumed it was supported by now.


The property also exists in the SharePoint Online documentation.

how do you build the context with creds etc?

a example of mine

 SharePointService sharePointService = new SharePointService();
            AuthenticationManager authenticationManager = new AuthenticationManager();
            using (
                ClientContext adminContext =
                    authenticationManager.GetSharePointOnlineAuthenticatedContextTenant(Info.TenantAdminUri.AbsoluteUri, Info.UserName,
                adminContext.RequestTimeout = Timeout.Infinite;

hope it helps

I've tried both AppOnly context with full SiteCollection permissions and SharePointOnlineContext.

Neither works. 

I can however create/delete sitecollections and change other properties, but NewUrl doesn't work. So I believe my context is ok.


@Deleted you're saying that it works for you? My ServerLibraryVersion is 16.0.6511.1201.

Hi I am just checking your code.

What are you trying to accomplish?


Since i see you get the url then want to update the url??

That will not work.

Yes, I want to update the url. I'm creating a "buffer" of site collections and want to give them a proper url when they're taken into use.


If that doesn't work, then what is the usage of NewUrl?

Why is it available? Is it because is only works on premises?

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.





have 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


Hi @Deleted,


I tried this:


$site = Get-PnPTenantSite

$site.NewUrl = ""




and then I tried all variations of Urls for the $site.NewUrl = ""


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.

Just checked with reflector code is implemented but can not debug it :(