How can I verify that a SharePoint URL already exists within a site collection?
Eg. I'm in a site collection, and I want to create a new subsite. How can I verify that the subsite is not already there using PowerAutomate?
Solved! Go to Solution.
You can use the Send an HTTP request to SharePoint action using this URL "https://<your sharepoint site>/_api/web/webinfos" and it will return the subsites as an XML response.
Try it out 🙂
Kind regards, John
This is what I did:
The issue is that the condition's "answer" is always "False", although the URL is there.
Any idea how can I get "true" when the URL exists and "false" when it doesn't ?
The result from the call is an object, so Contains will not work. Convert the Body to a string using the expression:
You suggestion works!!! Thanks a lot!
Now the problem is that if the URL doesn't exist, I won't get a "False" within the condition.
The Flow will stop with a NOT Found error and I never reach the condition step.
Could you suggest another way to check is a SPWeb exists and if not create a new one?
Good that it works 🙂 You are correct that the flow will fail at the HTTP action, if the URL does not exist.
You can replace your Condition action with a parallel branching, where the two parallel branches each can handle the success or the failure of the HTTP action.
Configure each branch run after settings
One to run upon success, one to run on failure.
Hope the above helps you on the way to a solution 🙂
Kind regards, John
Thanks a million!!! It works great!!!
I'm documenting this if some other people try to do similar things:
Here is the flow:
In case the site exists:
And in case the site doesn't exist:
Learn how to create your own user groups today!
Check out the new Power Platform Community Connections gallery!
Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.