cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper II
Helper II

Based off a date in a sharepoint list, move created item into folder

Hello, 


I have an app that uploads a photo to a document library. This document library is essentially a landing page for the data. I have 12 other documents libraries labeled like the following. 

-------------------

October 2020

November 2020

December 2020 

January 2021

------------------

I need to build a flow that is triggered from the document being created in Sharepoint and then checks the date that a user inputs and sends it to its perspective folder based off of the month. For example if a user submits a record with a selected date of 9/19/20 that the file is moved to the September folder.

 

Does anyone have any ideas on how to get this done?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User
Super User

Re: Based off a date in a sharepoint list, move created item into folder

Hi @Maxwell123 

  • You have to create an Automated Flow using the trigger When a file is created or modified (properties only)
  • Fill in the properties like Site AddressLibrary Name.
  • Add the action named Condition. You should add 2 conditions with And operator.
    • Check whether the file is checked out or not
    • Check whether it is a file and not a folder.

sudharsan1985_0-1601538793493.png

  • In the Yes branch of the condition, add the action Compose and define the following expression replacing the internal name of the date field. My date field name is UploadDate, you had to change it to yours.
formatDateTime(triggerOutputs()?['body/UploadDate'], 'MMMM yyyy')
  •  Add the action Move file and fill in the following properties
    • Current Site Address - Source library site collection
    • File To Move - Choose the Identifier from the triggerOutput property.
    • Destination Site Address - If it is a same document library, choose the same site address or different based on your req.
    • Destination Folder - /<Dest document library name>/<Compose action output>
    • If another file is already there - Choose any of the option based on your req.

sudharsan1985_1-1601539160841.png

Try the above steps and let me know if you have any clarifications.

Happy Flowing...

 

 

Hope it helps, please like it or mark it as a solution if it resolves your clarification or issue
-Sudharsan K...

View solution in original post

6 REPLIES 6
Highlighted
Super User
Super User

Re: Based off a date in a sharepoint list, move created item into folder

Hi @Maxwell123 

  • You have to create an Automated Flow using the trigger When a file is created or modified (properties only)
  • Fill in the properties like Site AddressLibrary Name.
  • Add the action named Condition. You should add 2 conditions with And operator.
    • Check whether the file is checked out or not
    • Check whether it is a file and not a folder.

sudharsan1985_0-1601538793493.png

  • In the Yes branch of the condition, add the action Compose and define the following expression replacing the internal name of the date field. My date field name is UploadDate, you had to change it to yours.
formatDateTime(triggerOutputs()?['body/UploadDate'], 'MMMM yyyy')
  •  Add the action Move file and fill in the following properties
    • Current Site Address - Source library site collection
    • File To Move - Choose the Identifier from the triggerOutput property.
    • Destination Site Address - If it is a same document library, choose the same site address or different based on your req.
    • Destination Folder - /<Dest document library name>/<Compose action output>
    • If another file is already there - Choose any of the option based on your req.

sudharsan1985_1-1601539160841.png

Try the above steps and let me know if you have any clarifications.

Happy Flowing...

 

 

Hope it helps, please like it or mark it as a solution if it resolves your clarification or issue
-Sudharsan K...

View solution in original post

Highlighted
Helper II
Helper II

Re: Based off a date in a sharepoint list, move created item into folder

Hello!

 

Thank you so much for your detailed response! I have built a similar flow and have been testing with this all morning. I am very stumped right now. 

 

I have attached a couple of photos pertaining to my issues but I will go into detail on them below:

 

The condition reads: 

 

ActionFailed. An action failed. No dependent actions succeeded.
 
The Compose action works and I have tried changing my manual date that it reads in powerapps and both times I can tell it is directed to the right library! I tried todays date and it is trying to send to my "October 2020" library and I tried november 1st and it tried to send to "November 2020"
 
On the Move File the error I get is "BadRequest"
 
I can tell that it is trying to move the right file but on the outputs part of the error report this is the attached string.
  "message""Missing or mismatched field definition on the destination list for source field '_x0076_zd7' type 'Text'. Source site template id 'GroupWebTemplateID', target site template id 'GroupWebTemplateID'. Total blocked root objects in this operation is [1].\r\nclientRequestId: a4615558-a877-459f-99fc-5643eabd77f5\r\nserviceRequestId: a4615558-a877-459f-99fc-5643eabd77f5"
 
 
Could this be that my date coming into Sharepoint from powerapps and the Sharepoint list column "PurchaseDate" is formatted for text? 
 
Please Let me know if you need anymore information on this and I sincerely thank you for your help and insight!
 
Maxwell  
 
 Screen Shot 2020-10-01 at 11.40.03 AM.pngScreen Shot 2020-10-01 at 11.39.47 AM.png
 
Highlighted
Super User
Super User

Re: Based off a date in a sharepoint list, move created item into folder

Hi @Maxwell123 

Are you trying to move the files in the same library inside a folder or a different from the source library? Also, can you confirm the custom fields if any are the same in their name and datatype on both the libraries?

 

Hope it helps, please like it or mark it as a solution if it resolves your clarification or issue
-Sudharsan K...
Highlighted
Helper II
Helper II

Re: Based off a date in a sharepoint list, move created item into folder

Hello, 

 

I am trying to move a from one document library to another. To go over my process A user takes a picture of a credit card receipt and sends it off to a Sharepoint document library called "Credit Card Receipt Data" This essentially is a landing page for the data and from here I need to flow to check the "PurchaseDate" as sometimes these receipts will be uploaded in the month after they were bought. Based on the purchase date I need the flow to move the file to the correct document library like "October 2020" or November "2020"

 

Again I appreciate your help so much!! 

 

Thanks

Highlighted
Super User
Super User

Re: Based off a date in a sharepoint list, move created item into folder

Hi @Maxwell123 

If you are moving to a different library, can you please confirm the fields are the same in name as well as in field type? Just try the flow with the new test libraries created without any fields, normal default document libraries. If your flow is successful in moving the file then the problem is with the fields. Try it out and let me know if you have any issues.

 

Hope it helps, please like it or mark it as a solution if it resolves your clarification or issue
-Sudharsan K...
Highlighted
Helper II
Helper II

Re: Based off a date in a sharepoint list, move created item into folder

Hello!

 

I was 100% certain all the fields were exactley the same in both libraries however there was 30+ columns! My workaround was just to do a copy and delete instead of a move! Thank you so much for your insight and the time you took to help me out!

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Upcoming Events

Experience what’s next for Power Automate

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

Users online (6,745)