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?
KR
Henning
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:
https://msdn.microsoft.com/en-us/library/office/aa543822(v=office.14).aspx
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:
substringof('0x0120D520',ContentTypeId)
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 sets
Query filter that returns empty array
Empty array result of running Flow
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:
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:
substringof('0x0120D520',ContentTypeId)
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:
Note: On my side, within right input box of Filter array condition, type the following formula:
The flow works successfully as below:
More details about enable Content Types in SharePoint library, please check the following article:
Best regards,
Kris
Hi. Thanks for reply. A couple of points to clarify my situation.
Thanks.
Henning
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.
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'))
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
Announcing a new way to share your feedback with the Power Automate Team.
User | Count |
---|---|
75 | |
20 | |
17 | |
14 | |
13 |
User | Count |
---|---|
127 | |
35 | |
31 | |
28 | |
25 |