Introduction
Developers do automation to make sites and teams implement processes in organizations.
Recently, I was part of one of the automation projects and wanted to check requested site name exists or not in the Tenant level Site Recycle bin.
Yes, it is possible to check using PowerShell script in logic apps but in my case, the client wouldn’t want to use logic apps because to reduce cost. I implemented power automation by using a standard SharePoint connector to check deleted sites.
Learning Objectives
- Create Manual Trigger Power Automate
- Generate Request Digest
- Query to get deleted sites
- Output
Prerequisite
- M365 environment
- Power automate access requires a license
- SharePoint Admin Access
Create Manual Trigger Power Automate
Click on Create new Power Automate and Select Manual trigger option.
Create a parameter called “SiteURL”.

Initialize variable with name “RequestDigest”.

Initialize the variable with the name “GetDeletedSitesProcessQuery” and add the below value to it.
<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="PowerAutomate" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions><ObjectPath Id="2" ObjectPathId="1" /><ObjectPath Id="4" ObjectPathId="3" /><Query Id="5" ObjectPathId="3"><Query SelectAllProperties="false"><Properties /></Query><ChildItemQuery SelectAllProperties="true"><Properties><Property Name="Url" ScalarProperty="true" /><Property Name="SiteId" ScalarProperty="true" /><Property Name="DaysRemaining" ScalarProperty="true" /><Property Name="Status" ScalarProperty="true" /></Properties></ChildItemQuery></Query></Actions><ObjectPaths><Constructor Id="1" TypeId="{268004ae-ef6b-4e9b-8425-127220d84719}" /><Method Id="3" ParentId="1" Name="GetDeletedSitePropertiesFromSharePoint"><Parameters><Parameter Type="String">0</Parameter></Parameters></Method></ObjectPaths></Request>






Sagar LadPosted Sep 24, 2021, 8:11 PM
Informative article