1

I want to change the URL of a modern team site (without group, STS#3) by HTTP Request. Which API request do I need to do?

I already tried by using GRAPH API but it only updates the displayName and not the URL.

{
    "uri": "https://graph.microsoft.com/v1.0/sites/contoso.sharepoint.com:/sites/oldname",
    "method": "PATCH",
    "headers": {
        "Content-type": "application/json",
        "Authorization": "*sanitized*"
    },
    "body": {
        "displayName": "newname",
        "webUrl": "https://contoso.sharepoint.com/sites/newname"
    }
}

4 Answers 4

0

You could change site url in SharePoint admin center as a workaround.

SharePoint admin center > Sites > Active sites > click your site > Edit > Edit URL

enter image description here

enter image description here

1
  • Is there any update on this thread? Comment here if you still need any help. Feb 8, 2022 at 9:51
0

I was looking for the same answer. It looks like the webUrl property is read-only and cannot be modified through the Microsoft Graph API: site resource type

0

You can do that using PowerShell cmdlet: Start-SPOSiteRename

REF: https://learn.microsoft.com/en-us/powershell/module/sharepoint-online/start-spositerename?view=sharepoint-ps

Try to review cmdlet code maybe it will point you how to do it over web request.

0

@user101830, this is possible using the SharePoint Admin API.

This is something asked in MANY places, and I don't believe that there's an answer for it, so I figured that answering it here would benefit everyone.

Solution - The SharePoint Admin API

Using the SharePoint Admin API you can achieve what you need, here.

METHOD

POST

URI

https://contoso-admin.sharepoint.com/_api/SiteRenameJobs?api-version=1.4.4

HEADERS

{
    "ODATA-VERSION": "4.0",
    "Accept": "application/json;odata.metadata=minimal",
    "Content-Type": "application/json;charset=utf-8"
}

BODY

{
    "SourceSiteUrl": "https://contoso.sharepoint.com/sites/oldname",
    "TargetSiteUrl": "https://contoso.sharepoint.com/sites/newname",
    "Option": -2147483648
}

Other Information

Headers

I have not tried this without the above headers, but it doesn't need a contextinfo.

Permissions

Whichever method you use to send this command ensure that the delegated account that is sending it has the SharePoint Administrator role, or equivalent permissions, and add whatever you need to add to authenticate that, do so.

I use the SharePoint connector's 'Send an HTTP request to SharePoint' action.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.