09-01-2020 14:18 PM
How to check whether a SharePoint site exists or not by using a flow
In Power Automate, there is no direct action to check whether a SharePoint site exists or not. So, we need to rely on existing SharePoint actions.
I am using "Get Lists" action from SharePoint connector. I am providing the SharePoint site URL to "Get Lists" action. When this action executes as part of the flow execution, we will run into following scenarios:
A. When the SharePoint site does not exists: In this case, "Get Lists" action, throws 404 exception.
B. When the SharePoint site exists but the flow creator does not have access to the site: In this case, "Get Lists" action, throws 403 exception.
C. When the SharePoint site exists: In this case, "Get Lists" action returns all the lists in the SharePoint site.
In the flow, I placed a Switch action to handle exceptions raised by "Get Lists" action.
For complete details, please watch my YouTube video at https://youtu.be/6oPFlXFczAU
I hope this will be useful for you.