// Collects Site Pages in the specified Site using an API call
// Onscreen banner, to advise that the App is doing something
Set(varWorkingOnIt, "Retrieving Site Pages for the specified Site using API... this may take a mo or two depending on the number of pages...");
// Resets any variables and collections
Set(varSitePages, Blank());
Clear(colSitePages);
// Sets the response of the flow in a variable
If(
IsBlankOrError(
Set(varSitePages,
SPAPIEndpointExplorer.Run(
"https://TENANT.sharepoint.com/teams/" & varLookUpSite, // Team Site Code
"GET", // REST Method
"_api/web/lists/GetByTitle('Site%20Pages')/items?$select=Title,ID,Created,Modified,CanvasContent1,FileLeafRef&$expand=Author&$select=Author/Id&$expand=Editor&$select=Editor/Id", // URI
"{
'accept': 'application/json;odata=nometadata',
'content-type': 'application/json'
}", // http headers
"" // body if needed
).response
)
),
// If error, notifies the User
Notify("Unable to collect Site Pages for the specified Site. Please try again. If symptoms persist, shoot the Developer.", NotificationType.Warning),
// If no error, collects the variable values in a table
Collect(
colSitePages,
ForAll(
Table(ParseJSON(varSitePages).value),
{
Content: Text(Value.CanvasContent1),
Created: Text(DateTimeValue(Text(Value.Created)), "[$-en-US]dd-mmm-yyyy, hh:mm am/pm"),
'Created By': Text(Value.Author.Id),
ID: Value(Value.ID),
Modified: Text(DateTimeValue(Text(Value.Modified)), "[$-en-US]dd-mmm-yyyy, hh:mm am/pm"),
'Modified By': Text(Value.Editor.Id),
Link: Text(Value.FileLeafRef),
Title: Text(Value.Title)
}
)
);
// Clears the banner
Set(varWorkingOnIt, "");
// Navigates to the screen for a gallery review of the collection
Navigate('Review API Screen *')
)