Showing results for 
Search instead for 
Did you mean: 
Advocate III
Advocate III

Get items filter query to only fetch document sets

I have a flow that shall send notifications on document sets only, not the documents within. I am currently filtering the query based on a specific content type name like this: " ContentType eq 'Contract Document Set' ", which works fine. I am though using this flow on setups where other document set content types apply so would like to make it generic for any document set.


I have tried to replace the query filter using " IsContainer eq 'True' " or also " ProgId eq 'Sharepoint.DocumentSet' " but none seem to work. When running the flow it just keeps running and running. Not failing but not returning anything either.


What built in properties can I use to get the wanted effect?






You could make use of the Content type ID. So in a list I created a document set and my flow triggered. Then I collected the Content type Id . this now gives you the GUID. All document sets should start with 0x0120D520



So, now you can use this in your query for your trigger or include this in a condition after your trigger.


I would however be careful. As modern libraries don't fully support document sets and Flow is supported on moderen libraries ( and works on traditonal libraries) you might find soe unexpected problems on the way.

Thanks for reply. However I'm not sure how this can help me as there is no 'contains' operator in the filter, so no way to filter on content type IDs that start with a certain pattern. Am I right? I don't want to hard code one specific value for one specific content type, unless I can filter by the parent content type ID (all CTs are children of one parent).

Something like this should work:



When a document set is created I'm sedning an email (you could of course do anything else) and when a document is uploaded I'm simply going to ignore the upload. 


All content type ids are built up as described here:


Sure. In conditions it will work. However, I would like to not draw more items into the initial query than necessary, so my thinking now is to use a custom property like a boolean isCT column that is default set to true, that should be possible to use in the query.


Am I right that there is a limitation in Flow currently on how many rows a query can return? This is partly why I want to use query filters instead of conditions.

Ah ok, you're running a get items, where I'm assuming that there is a document that triggerws the flow. Hence I would only pick up one document. ( i.e. not hitting the limitations)


If you go for Get Files (properties only) then you could make the contains work with the following filter:



if, ContentTypeId existed in the Get Files. I also tried using get items on the library but that doesn't seem to return documents/document sets.


this might be one for a uservoice.








FYI - my earlier reply is gone, so if this appears as duplicate, that's why.


I am actually using the Get files (properties only), but with a recurrence trigger and an apply to each loop to send email to contract responsible once an alert date on the document set is reached. As there might be hundreds or thousands of document sets in the library I still would like a confirmation on the limitations of the query (max number of items).


I did try to replace the " ContentType eq 'Contract Document Set' " with " substringof('0x0120D520',ContentTypeId) " but my array just turns out empty. I can confirm that the ID of my document set content type does start with the same value: 

0x0120D52000A26333CE96FAB54DA27A0B6B52C9A8A002003021D45A4E46A44992001AF0C835AA44. To verify I added Content type Id to be printed in the emails sent from the Flow.


Query filter that returns doc setsQuery filter that returns doc sets

Query filter that returns empty arrayQuery filter that returns empty array


Empty array result of running FlowEmpty array result of running Flow

Community Support
Community Support

Hi @HenningStrand,


Could you please share a full screenshot of your flow's configuration?

Do you enable Content Types option within your SharePoint library?

Further, do you want to filter files based on ContentTypeId using OData query within Filter Query field of "Get files (properties only)" action?


I suppose that you have enabled Content Types option within your SharePoint library, I have made a test on my side and the Content Type Id doesn't start with '0x0120D520'. The Content Type Id of my documents as below:10.JPG


There is no column called ContentTypeId in SharePoint library, the ContentTypeId column shown as {ContentType}#Id in SharePoint library (as above screenshot), so the formula that you provided as below within Filter Query field of "Get files (properties only)" action is not valid:


I afraid that there is no way to filter files based on ContentTypeId using OData query within Filter Query field of "Get files (properties only)" action in Microsoft Flow currently.



You could consider take a try to add a "Filter array" action to filter files, I have made a test on my side and please take a try with the following workaround:11.JPG

Note: On my side, within right input box of Filter array condition, type the following formula:13.JPG



The flow works successfully as below:12.JPG



More details about enable Content Types in SharePoint library, please check the following article:


Best regards,




Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi. Thanks for reply. A couple of points to clarify my situation.

  1. Content types are enabled and in use in my library
  2. The library will contain hundreds or thousands of items (doc sets and documents). I am worried about current limitations of Flow queries. I Believe a query will only retrieve up to 5000 items. Hence I want to limit the number of items returned in the Get files (properties only) action, which is why I want to do this in the ODATA query filter, not in an action.
    1. (Also in general it is good practice to have a program/flow handle only the relevant items)
  3. As there is no contains or like operator, I need to figure out a different approach.
  4. So my question is really only about: how to return only document sets in the initial Get files (properties only) ODATA query filter?



I need to verify in flow. But you should be able to get the files in a folder where you consider the document set to be a folder.
Impactful Individual
Impactful Individual

Sorry I posted in the wrong thread... Can't seem to be able to delete... it is related, but should be in my post.


I think I'm on the right track, but I've screwed up the subsequent actions.   Configuration is attached.  Unfortunately the first switch case is being sent for some reason when the date condition is met.






Helper II
Helper II

There's no way to use an odata expression to filter by Content Type when using the Get Files (properties only) action?

Something like:
ContentType eq 'Leave Request'

substringof just returns empty arrays but startswith works.  The ContentTypeId always prepends the child id so this works as desired.


(OData__ModerationStatus eq 'Pending') and (startswith(ContentTypeId,'0x0101ABC123ABC123ABC123ABC123ABC123ABC123'))

Helpful resources

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Super User 2 - 2022 Congratulations 768x460.png

Welcome Super Users

The Super User program for 2022- Season 2 has kicked off!

Users online (2,753)