cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
daniellemaree
Level: Powered On

Bad Request - Move File

HI 

 

I have a flow that pulls out attachment files from outlook and stores into SharePoint document libraries. I am using the step "move file". 

 

however it keeps bringing back this error message 

"status": 400,
"message": "Fatal failure occurred during convert stage. Error is: Failed to identify the target parent folder id for /Shared Documents/Client Folders/Danielle Sutton/TEST.doc.\r\nclientRequestId: fe016337-337f-4733-a66b-b745e9301338\r\nserviceRequestId: 0cd5ba9e-20e4-8000-0729-8435e007f316"
}
 
Capture4.PNG
1 ACCEPTED SOLUTION

Accepted Solutions

Re: Bad Request - Move File

The move file action would be for moving the file from one SharePoint site to another.  If you are looking to save an email attachement to SharePoint you will want to use the "Create File" action. You will then use the File Name and File Content from the "When a new email arrives" trigger.

saveattachment.jpg

 

 

View solution in original post

18 REPLIES 18

Re: Bad Request - Move File

The move file action would be for moving the file from one SharePoint site to another.  If you are looking to save an email attachement to SharePoint you will want to use the "Create File" action. You will then use the File Name and File Content from the "When a new email arrives" trigger.

saveattachment.jpg

 

 

View solution in original post

v-zhos-msft
Level 10

Re: Bad Request - Move File

Hi daniellemaree,

According to your description, what your purpose is copying the attachment files from outlook and storing into SharePoint document libraries.

As @spsolutionsgrp’s advice, I suggest you to use the Create file action of Share point.

I have made a flow for your scenario, please check it for a reference.

8.png

Please feel free post back if you need more help.

Best regards,

Zhonys

Re: Bad Request - Move File

@daniellemareedid this solve your issue.  Please mark as the solution if it did or let me know if you have any questions. 

 

Thank you

daniellemaree
Level: Powered On

Re: Bad Request - Move File

Hi @v-zhos-msft & @spsolutionsgrp

 

Currently, the solution I have built when an email arrives, it gets the email and needs to validate against a SharePoint list to see if the client exists, if the client does the attachment is moved to the designated sharepoint folder. 

 

There is a condition that checks the output value 

first(body('Get_items')?['Value'])?['Title'] to see if it is valid. 
 
After this it gets the URL of SP list folder and applies the different condition based on the file type. The attachments can be different file types i.e .doc,.xlsx, .xls, .pdf , .ppt, .pptx. 
 
Instead of the move file action would it be best to use the create file step?

Re: Bad Request - Move File

If you are going from Outlook to SharePoint with the attachment it will have to be Create File.  If the file was already stored in SharePoint then you wanted to change the location you would user "Move File"

Highlighted
daniellemaree
Level: Powered On

Re: Bad Request - Move File

@spsolutionsgrp thanks! 

 

ill test this. So after the attachment has been created it needs to distinguish between the different file type. The file name needs to end in only the format i.e .doc, .docx, .ppt, .pdf 

 

 

How can this be done?

Re: Bad Request - Move File

sorry if I am asking a question that you aleady answered.   You only want to save the file if it is one of those formats or depending on the format you are going to save the file in a different location?

 

If it is the first you will need to create a condition so it only saves the file if it is one of the formats.

 

Here is a sample condition .... @endswith(items('Apply_to_each_2')?['Name'], '.jpg') OR endswith(items('Apply_to_each_2')?['Name'], '.doc') 

 

Then if yes, Create File and if No do nothing.

daniellemaree
Level: Powered On

Re: Bad Request - Move File

Hi @spsolutionsgrp

 

Yes thats correct. It needs to only save in the file formats it will save into the designated clients folder in the SP library. 

 

Does the condition statement go to the top of the flow? The example you have mentioned?

 

So currently the flow. 

  1. it gets the email
  2. checks into a sharepoint list where the email address are stored.
  3. After this it will compose   -   first(body('Get_items')?['Value'])?['Title']
  4. After this step it will have a condition to see if the email address is in the client list so it can move to the client SP folder where it will create the file

 

Re: Bad Request - Move File

I did not create the dynamic Customer folder but here is the rest (if you need help with the dynamic folder I can help with that too but I think you have that piece).

 

SaveAttachment2.jpg

 

The condition that I used is...

 

@endswith(items('Apply_to_each')?['Name'], '.doc') Or endswith(items('Apply_to_each')?['Name'], '.docx') Or endswith(items('Apply_to_each')?['Name'], '.xls') Or endswith(items('Apply_to_each')?['Name'], '.xlsx') Or endswith(items('Apply_to_each')?['Name'], '.pdf') Or endswith(items('Apply_to_each')?['Name'], '.ppt') Or endswith(items('Apply_to_each')?['Name'], '.pptx')
 
daniellemaree
Level: Powered On

Re: Bad Request - Move File

@spsolutionsgrp Thanks for the tip. 

 

I am still learning advance conditions in flow. 

 

I was wondering if you could validate this condition with the one you have provided too. To see if this is correct?

 

@equals(outputs('Compose'), items('Apply_to_each')?['Title']) AND @endswith(items('Apply_to_each')?['Name'], '.doc') Or @endswith(items('Apply_to_each')?['Name'], '.docx') Or @endswith(items('Apply_to_each')?['Name'], '.xls') Or @endswith(items('Apply_to_each')?['Name'], '.xlsx') Or @endswith(items('Apply_to_each')?['Name'], '.pdf') Or @endswith(items('Apply_to_each')?['Name'], '.ppt') Or @endswith(items('Apply_to_each')?['Name'], '.pptx')

 

 

Re: Bad Request - Move File

I can't tell what you are trying to do before the "AND".   Can you explain what that should do.

daniellemaree
Level: Powered On

Re: Bad Request - Move File

HI @spsolutionsgrp

 

So in my flow, the email is scanned to an SP list to check if the client's email/name is valid. 

 

I have a condition that checks the title to see if it matches the email address.

Then I have the create file.  See the screen shot

 

Before the create file is run, can you have a second condition to check the file name types?

 

The compose part of the flow contains this @equals(outputs('Compose'), items('Apply_to_each')?['Title']) 

Capture35.PNG

 

 

 

 

Re: Bad Request - Move File

Yes, you can add the condition and put the Create File action in the "yes" column.

 

 

 

If you found my resposes helpful please mark one as the solution.

 

Thank you,

daniellemaree
Level: Powered On

Re: Bad Request - Move File

@spsolutionsgrp    Thanks! I have

 

Just a quick question regarding the condition statement.. i used the example you had suggested but it throws an error

 

The template validation failed: 'The template action 'Condition_2' at line '1' and column '3943' is not valid: "Unable to parse template language expression 'endswith(items('Apply_to_each')?['Name'], '.doc') Or @endswith(items('Apply_to_each')?['Name'], '.docx') Or @endswith(items('Apply_to_each')?['Name'], '.xls') Or @endswith(items('Apply_to_each')?['Name'], '.xlsx') Or @endswith(items('Apply_to_each')?['Name'], '.pdf') Or @endswith(items('Apply_to_each')?['Name'], '.ppt') Or @endswith(items('Apply_to_each')?['Name'], '.pptx')': expected token 'EndOfData' and actual 'Identifier'.".'.

 

@endswith(items('Apply_to_each')?['Name'], '.doc') Or @endswith(items('Apply_to_each')?['Name'], '.docx') Or @endswith(items('Apply_to_each')?['Name'], '.xls') Or @endswith(items('Apply_to_each')?['Name'], '.xlsx') Or @endswith(items('Apply_to_each')?['Name'], '.pdf') Or @endswith(items('Apply_to_each')?['Name'], '.ppt') Or @endswith(items('Apply_to_each')?['Name'], '.pptx')

 

 

Any suggestions?

daniellemaree
Level: Powered On

Re: Bad Request - Move File

@spsolutionsgrp Thanks I have

 

Also I tried your condition statement but it throws an error 

 

The template validation failed: 'The template action 'Condition_2' at line '1' and column '3943' is not valid: "Unable to parse template language expression 'endswith(items('Apply_to_each')?['Name'], '.doc') Or @endswith(items('Apply_to_each')?['Name'], '.docx') Or @endswith(items('Apply_to_each')?['Name'], '.xls') Or @endswith(items('Apply_to_each')?['Name'], '.xlsx') Or @endswith(items('Apply_to_each')?['Name'], '.pdf') Or @endswith(items('Apply_to_each')?['Name'], '.ppt') Or @endswith(items('Apply_to_each')?['Name'], '.pptx')': expected token 'EndOfData' and actual 'Identifier'.".'.

 

Any ideas??

Re: Bad Request - Move File

Sorry, wrong "or" syntax. Give me just a second and I will send over the correct one

 

Re: Bad Request - Move File

Here is the correct syntax for the condition.

 

@or(
endswith(items('Apply_to_each_3')?['Name'], '.doc'),
endswith(items('Apply_to_each_3')?['Name'], '.docx'),
endswith(items('Apply_to_each_3')?['Name'], '.xls'),
endswith(items('Apply_to_each_3')?['Name'], '.xlsx'),
endswith(items('Apply_to_each_3')?['Name'], '.pdf'),
endswith(items('Apply_to_each_3')?['Name'], '.ppt'),
endswith(items('Apply_to_each_3')?['Name'], '.pptx'))

 

I am doing some additional testing on the create file but have to jump in a meeting so it may be a bit.

Re: Bad Request - Move File

@v-zhos-msftshowed this yesterday.  There is a bug in the Create File when getting information from an attachment.  You may need to create a Get file (outlook) action and use the body of that action in the File Content of the Create File action.

 

I have tested and everything works great.

finalattachment.jpg

 

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020.

thirdimage

Flow Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Flow Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 101 members 3,749 guests
Please welcome our newest community members: