Using Flow to get or check for files in a large SharePoint library can be a little tricky. If you are sure your library will always stay under 5,000 items the Get Files (properties only) Flow action is a quick n’ simple approach to use. When your library crosses over the mythical 5k mark or somewhere in that neighborhood, the Get Files action will fail to return results without warning. What I’m outlining below are other options when working with large libraries.
Option 1: Get Files using an Odata filter query downside: only use this in small libraries
Option 2: use the SharePoint API downside: the lack of transparency from Microsoft related to how often data is crawled.
Option 3: use the SharePoint API along with a filter action on the library. This option does require that you have metadata set up on the library to filter on and there is not a wildcard / contains option. The filtered value needs to be exact. downside: you will need to set up your metadata ahead of time or create it after the fact then backfill.
The more I learn about Flow and SharePoint Online, the more I’m starting to like Option 3 when doing a lookup type of search. SharePoint Search is an extremely powerful tool if the search index is fresh.
Scenario: Each day I have a couple of Azure Runbooks export SharePoint list items and upload them to a SharePoint library. If one of the Runbooks fails, I needed to send an email alert that something went wrong.
Basic logic: If files created today in SharePoint <> X, send an email.
The easy solution would have been to loop through the files, check their created date, increment a variable, then make a condition statement.
More-better way: Run flow daily at 6:00 PM Send an HTTP request to SharePoint to get files Parse the response Condition statement — if true, send an email
I was trying to use a SQL Insert Row action to insert a new row in a SQL Server table and received a Bad Gateway error. First, I thought it was a permissions issue, then I thought my Flow stopped working…
Turned out to be an issue with the amount of data being inserted into a field. One SQL column was set to varchar(X) and the Flow was trying to insert more characters than X.
On the surface, this request sounded super simple and straightforward. “we need to copy files from a SharePoint library to Blob storage.” Simple enough? Well, yes, but the SharePoint library has a couple of required fields and a Flow is triggered by an action.
Consider what I’m outlining below to be version ONE of the process. In the near future, I will update this post with a slightly more resilient solution.
My SharePoint library has a required field titled DesinationFolder
Context of what I’m doing in the Flow: Trigger: When files is created in a folder When a file is added to a library the flow is triggered Get file metadata File Identifier: Use File identifier from the step above Get file properties Id: Use the ItemId from the previous step Initialize variable Name: vCheckedOut Type: Boolean Value: Checked out (field from Get properties) Initialize variable Name: vFolderPath Type: String Value: Condition vCheckedOut is equal to true Yes: Do until vCheckout is equal to False GetFileProperties Set variable Name: vCheckedOut Value: Checked out (value from the Get file properties above) No: Set variable Name: vFolderPath Value: FolderPath (SharePoint field)