cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
kjwolf326
Frequent Visitor

Picture of the Day

Hello, 

I'm new to Power Automate and looking for assistance!  I'm trying to build a "Picture of the Day" on my SharePoint intranet homepage (modern communication site), and looking for a way with Power Automate.  I had previously connected a list webpart and had a view built to show based on a column named "Show Date", but the image is too small.  I'm hoping to use the column "show date" and make it so that a flow would copy a file to a new document library based on the show date matching [today].  Then have the flow rename the file to "picture of the day", so that the image viewer webpart would still be connecting to the same URL, and the image associated would rotate each day.

Below are my steps so far.  

 

1. Run the flow every day at midnight

2. Delete the existing Comic of the Day from the Shared Documents library.  (Doing it this way, so that when I hyperlink to this image on the homepage, the hyperlink will remain the same and not require me to update the homepage webpart.)

3. Get the properties of the Comic of the Day library? 

 

COTD Step 1-3.PNG

4. Attempting to grab the file properties?

COTD Step 4.PNG

5. Applying the condition to only run for when: Show Date, is equal to, formatDateTime(utcNow(), 'yyyy-MM-dd')

6. If yes it matches the show date from above, copy the file to the Shared Documents folder. 

7. Update the file properties to the name of "Comic of the Day".  (Again doing this to maintain the hyperlink on the homepage to be the same.)

COTD Step 5.PNG

 

*in copy file 2 above, It shows copying it to /homepage comic folder, I updated this to send to the /documents folder. 

 

I have the delete file working, but can't get it to grab the files.  

Any help or pointers is greatly appreciated!!  Or any other ideas/ways to achieve the end result.

 

Thanks, 

Kevin Wolf

2 REPLIES 2
edgonzales
Super User II
Super User II

@kjwolf326 

Hey there, I like the approach.  Here's a couple of things I might try:

  • Add your date filter to the OData Filter Query field in your Get Files (Properties Only) action.
    • Even if your ShowDate looks to be formatted the same, it is probably stored in the long format...so you'll want your query to have a formatdatetime() expression on both sides:  formatDateTime(<ShowTime field>, 'yyyy-MM-dd') eq formatDateTime(utcNow(), 'yyyy-MM-dd')
  • This will still produce an array (even if there's only one item that matches the ShowDate filter), so you'll want to use one of the tricks from Elaiza's video to convince Power Automate that you've picked only one.

  • From there, you can probably go straight into an Update File Properties to rename the file rather than a Get, and then rename.

You've probably already considered this, but if your process deletes the current image then eventually your folder will be empty (unless you add new ones).  You might consider renaming the old file to yesterday's date or something like that.

 

Another thing that might be fun would be to get the comic on the fly through a Bing image search or something like that.  Totally up to you, just throwing out some ideas.

 

Keep us posted on your progress, good luck!

-Ed

 

If you liked this reply, please give it a thumbs up! If this reply has answered your question or resolved your challenge, please consider marking it as a Solution. This helps other users find it more easily via search.

@edgonzales 

 

I appreciate the response and the ideas.  Unfortunately I'm still unable to make this one work.  I consistently get the flow to delete the existing file in my Document Library, no problems there.  I just can't get it to read the unique date field, and based on a match of date field = Today's date, then copy the file to the document library and then change the name.  I'm assuming once I got the match and copy to happen, the change title of document would be simple.  

 

As far as changing the name vs. deleting, I've got a picture library with 2 years worth of comics, after that I can change the dates and cycle through them again.  I wish I could do a Bing search, unfortunately these specific images are the ones that need to be on the site.  

 

Thanks again for all the input, anything else would be appreciated.  

Helpful resources

Announcements
MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MSFTBizAppsLaunchEvent

Experience what’s next for Power Virtual Agents

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (15,357)