Forum Discussion
REST API - Unable To Create Folder In Newly Created Team Site SiteAssets Library (Owned)
Incident
When I try to create a subfolder in the SiteAssets library with the following call, I keep getting unauthorised (or similar) responses.
| POST url | https://TENANT_SUBDOMAIN.sharepoint.com/sites/SITE_PATH/_api/web/folders |
| Body | { "ServerRelativeUrl": "/sites/SITE_PATH/SiteAssets/SitePages" } |
(annoyingly getting errors trying to submit the body in a codeblock, sorry)
Can anyone assist, please?
Further information is in the spoiler below ...
Further Information
Once in a blue moon this actually just decides to work, but it's very rare. The folder being created is SitePages, and I have the same/similar error when using default flow actions. Adding a space to 'SiteAssets' does not help.
- REST API Only - I am operating *purely* via the REST API and my workflow has made the site and applied a site design
- Fully Authorised - The user who is authorised is the owner of the new site individually and not as part of a group
- Interface - I am using Power Automate AND Logic Apps with the same results to get this - PLUS - No paid licence, so no premium connectors.
- Site Assets Exists - When I load the Site Contents (see below) it shows the Site Assets library and I have accessed it.
If I go to a separate request stream (even while that is retrying) I am able to send the request.
Is this some kind of lock-out?
I have a feeling simply by opening the site for the first time it suddenly enables the above API to work ... but I don't know an API call to do that.
Attempts To Activate The Site
Since I believe that this is actually something related to 'first access' I have been trying a number of things to awaken the site.
These include the following API calls:
- POST _api/web/AppTiles
- POST _api/web/SiteUserInfoList/GetItems
- POST _api/GroupService/SyncGroupProperties
- PATCH _api/Web with property 'NextStepsFirstRunEnabled' set to false
- PATCH _api/Web with property 'NextStepsFirstRunEnabled' set to false
Potentially Related Information
Also, I don't know if this is relevant, but I have noted that when looking at the status of the earlier SiteScript in the workflow that there are folder actions which are not getting the default '0' result. Which I am assuming is an error.
The issues here are returning the following:
OK, it looks like there is an answer, and I got it from the 365 / Power Platform community.
Essentially, since there is no requirement for the Site Assets until someone has looked at anything, then the library is either not enabled or provisioned in some way.
annajhaveri, over at the Power Automate community supplies the actual call needed to do this:
POST - _api/web/lists/ensureSiteAssetsLibrary
This then allows actions on that library without loading the site.
1 Reply
- Eliot_ColeIron Contributor
OK, it looks like there is an answer, and I got it from the 365 / Power Platform community.
Essentially, since there is no requirement for the Site Assets until someone has looked at anything, then the library is either not enabled or provisioned in some way.
annajhaveri, over at the Power Automate community supplies the actual call needed to do this:
POST - _api/web/lists/ensureSiteAssetsLibrary
This then allows actions on that library without loading the site.