cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Chrono9084
Helper I
Helper I

Gathering multiple files posted within a set amount of time from a trigger and posting a single message to teams.

Thanks to the help of @JohnAageAnderse  I was able to build a flow that posts a message to a channel when a file is posted in that channels folder structure on Sharepoint.  After doing some testing I realized that, while it works perfectly as designed, I am going to spam a channel if someone dumps a collection of files all at once which will cause far too much clutter.

 

My question is this: Is it possible to build a flow where the initial trigger is "When a file is created (properties only)" but then the flow waits for a set amount of time (say 5 minutes), gathers a list of any other files that were created within the same folder in that period and then posts a list of all of those files?  It would have to somehow prevent this flow from running for each file that is uploaded within that window while it is running on the first file that was uploaded or else I foresee it causing a cascading effect.

13 REPLIES 13
JohnAageAnderse
Memorable Member
Memorable Member

Hello @Chrono9084 

You are correct in trying to avoid spamming the channel 🙂

I suggest you use a Recurrence trigger action instead as your starting point.

Let say that it will be setup to run every 2 hours.

When it runs, your first action, after the trigger, would be to Get files (properties only) with a Filter query statement to include only files created within the last 2 hours.

With this, you can then collect all filenames and make one post only.

Hope this helps you on the way.

Kind regards, John

@JohnAageAnderse 

 

Would this work when monitoring multiple channels and having to post multiple messages to multiple channels if files were uploaded to folders in each of those channels in that time period?

Hello @Chrono9084 

Yes, it would. An action Get files (properties only) without specifying the folder, would get files from within the library no matter in which folder level the file is created.

You can start slowly by first building a flow with the Recurrence trigger and the Get files... action, then see what you get. When satisfied you build further.

Kind regards, John

@JohnAageAnderse 

 

Well, this is as far as I could get but I can't seem to get it to post the messages.  I have a feeling you will be able to figure out what I did wrong pretty quickly....I appreciate the help.

8.PNG9.PNG10.PNG11.PNG12.PNG13.PNG14.PNG

Hi @Chrono9084 ,

 

You should choose the Channel id dynamic content instead of channel name:

1.png

 

Best regards,

Alice   

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

@v-alzhan-msft @JohnAageAnderse 

 

That worked and it is now posting messages but, unfortunately, they are all separate messages.  What method would be best to recombine those messages into groups per the channels they were placed in?


Edit: Actually....this ended up posting messages to all four channels in the team.  🤣  

 

Edit #2: And I think I know why...let me fix something before I return for help.  In trying to simplify the flow I removed a condition that is required.  /facepalm

@v-alzhan-msft @JohnAageAnderse 

 

Ok so I was able to fix the issue where it was posting to all channels by (not being stupid and) reinserting the Filter Array that makes sure that Folder Path contains Channel Name.  Unfortunately it is still posting a separate message for each item uploaded.  I have a feeling this has to do with Flow creating Apply to each buckets but maybe I am wrong?

Hello @Chrono9084 

I read the whole thread and it seems like you are nearly there, good work 🙂

 

To avoid posting in the channels for every file, you will have to collect the filenames in an array variable. Only then can you make the post with the filenames from the array variable (use a join to combine all the filenames for the post).

 

So you need to initialize an array variable.

You need to check if the output from the Filter array action has any files (length > 0), only then do you need to collect the filenames in the array variable, and then post one message with all the filenames from the array variable.

 

Kind regards, John

Hi @Chrono9084 ,

 

I would suggest you to explain more details about the requirement.

Do you want to send the email to each channel?

 

Best Regards,

Alice

 

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

@v-alzhan-msft @JohnAageAnderse 

 

As soon as I am out of a meeting I will build a quick flow chart to, hopefully, better explain what I am hoping to do.  Thanks!!

@v-alzhan-msft @JohnAageAnderse 

 

The flow should be monitoring a team and all of its channels file locations on sharepoint.  Every 5 minutes I want it to look for any new files posted in that 5 minute window.  A message should be sent to each channel for which a file (or files) was created in that channels folder system stating what files were posted and where they were posted within the folder structure.  Optimally, if multiple files were posted, they would be grouped by file location.

 

For example, lets say that we have three channels; A, B, and C.  Five files were uploaded to A (three in folder one and two in folder two). No files were uploaded to B.  And one file was posted to C in Folder One.

 

The following messages would be sent:

Channel A would get the following message: Files etc.txt, etc2.txt, etc3.txt were posted in Folder One by this person.  Files other.txt and other2.txt were posted in Folder Two by this other person.

Channel B would not get a message.

Channel C would get the following message: File coolimage.jpg was posted in Folder One by another yet some other person

 

Does that make sense?

Hi @Chrono9084 ,

 

This post is created 2 weeks ago and now you have the new requirement, I suggest that you could go ahead and mark the post as solved for the previous issue and then create a post with the new issue so we could see and better help you on the new issue.

 

Best Regards,

Alice

 

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

@v-alzhan-msft 

Technically this is the same thing I was asking in the original post, I just didn't explain myself as well as I could have.  While @JohnAageAnderse  has helped me get pretty far, I have still not reached my original goal.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Users online (1,227)