Create SharePoint Communication site request is broken
When I try to create communication site following the documentation on
https://docs.microsoft.com/en-gb/sharepoint/dev/apis/communication-site-creation-rest
I always get the following response:
{
"d": {
"Create": {
"__metadata": {
"type": "SP.Publishing.PublishingSiteCreationResponse"
},
"SiteStatus": 3,
"SiteUrl": ""
}
}
}
The request was to:
{tenant}/_api/sitepages/communicationsite/create
With the body:
{
"request":{
"__metadata":{
"type":"SP.Publishing.CommunicationSiteCreationRequest"
},
"Title":"Comm Site 1",
"Description":"Description",
"Url":"{tenant}/sites/comsite"
}
}
Site status with a return value of '3' means that site is "Creating". That should indicate that the site creation is in progress. Is the site created after a while or it's not created at all?
Site is not created at all
For https://{tenant}/sites/comsite, gives me 404 FILE NOT FOUND
@VesaJuvonen Is there a solution to this problem? This api is still broken.
@romanSlivinskyi Did you resolve this problem, Roman?
Yes, the site was in a recycle bin. So, you have to make sure that you completely deleted a site, if you make a new one with the same url. But the response for request is not informative.
@romanSlivinskyi Thanks for the response. I think i may be having a different problem. as my site is not in the bin. It's a brand new site.
Can you show the request you are traying to send? By the way, there are two bins, and the second one is only visible via powershell. Did you try to create your site through powershell?
@romanSlivinskyi
{ "request":{ "__metadata":{ "type":"SP.Publishing.CommunicationSiteCreationRequest" }, "AllowFileSharingForGuestUsers":"false", "SiteDesignId":"6142d2a0-63a5-4ba0-aede-d9fefca2c767", "Description":"aurora1234Site", "Title":"aurora1234Site", "Url":"https://mytenant.sharepoint.com/sites/aurora1234Site", "lcid":1033 } }
sending it to by POST: https://mytenant.sharepoint.com/_api/sitepages/communicationsite/create
https://docs.microsoft.com/en-us/sharepoint/dev/apis/communication-site-creation-rest
the status endpoint works fine with existing sites
@romanSlivinskyi also Roman can you tell which powershell command you're referencing when saying there is a second recycle bin?
Thanks!
I am sending the request to
https://mytenant-admin.sharepoint.com/_api/sitepages/communicationsite/create
So the host should be mytenant-admin, don't know is it a workaround or not, but it works for me. Also I use Get-SPODeletedSite to check deleted sites from recycle bin. and Get-SPOSite to fetch all of my active sites cause the old-classic ui , doesn't show them all.
@romanSlivinskyi Thanks for the help, unfortunately trying to create via this endpoint is still broken for me. I looked at the http headers in the admin portal and found a few undocumented endpoints one being https://tenant.sharepoint.com/_api/SPSiteManager/Create which allows me to create a site successfully and even allows me to add an owner in the request with the following body:
{ "request": { "__metadata": { "type": "Microsoft.SharePoint.Portal.SPSiteCreationRequest" }, "WebTemplate": "SITEPAGEPUBLISHING#0", "Title": "showcasetest", "Url": "https://mytenant.sharepoint.com/sites/showcasetest", "Description": "test", "Classification": "", "SiteDesignId": "6142d2a0-63a5-4ba0-aede-d9fefca2c767", "Lcid": 1033, "ShareByEmailEnabled": false, "WebTemplateExtensionId": "00000000-0000-0000-0000-000000000000", "Owner": "i:0#.f|membership|[email protected]", "HubSiteId": "00000000-0000-0000-0000-000000000000" } }
Have you tried to use mytenant-admin.sharepoint.com host? Can you show the response you receive?
@romanSlivinskyi I have tried with mytenant-admin.sharepoint.com and I have the same result. It comes back with 200 and a json body with the same same result:
{ "d": { "Create": { "__metadata": { "type": "SP.Publishing.PublishingSiteCreationResponse" }, "SiteStatus": 3, "SiteUrl": "" } } }
it is working fine for me. Please make sure you specify owner property. I was getting same error but I just appended owner property and it worked for me.
url: - https://camqa.sharepoint.com/_api/SPSiteManager/Create
headers :-
X-RequestDigest:{{SharepointFormDigest}}
Content-Type:application/json;odata=verbose
Accept:application/json;odata=verbose
body :-
{
"request": {
"__metadata": {
"type": "Microsoft.SharePoint.Portal.SPSiteCreationRequest"
},
"Title": "TestSitesunny222",
"Lcid": 1033,
"Description": "",
"ShareByEmailEnabled": false,
"SiteDesignId": "6142d2a0-63a5-4ba0-aede-d9fefca2c767",
"Url": "https://camqa.sharepoint.com/sites/TestSitesunny222",
"WebTemplate": "SITEPAGEPUBLISHING#0",
"WebTemplateExtensionId": "00000000-0000-0000-0000-000000000000",
"Owner": "i:0#.f|membership|[email protected]",
"HubSiteId": "00000000-0000-0000-0000-000000000000"
}
}
This issue is being closed as part of an issue list cleanup project. Issues with no activity in the past 6 months that aren't tracked by engineering as bugs were closed as part of this inititive. If this is still an issue, please follow the steps outlined to re-open or submit a new issue.
Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues