Showing results for 
Search instead for 
Did you mean: 
New Member

Save attachments to SharePoint list item

I have a flow that adds a new item to a SharePoint list. That works fine.

But i also want to take attachments and save them to the item - just as if the user uploaded attachments manually.

The location for manual uploaded attachments are list/thelist/Attachments/<id/....


the error is (Response, have exchanged names with < >):


{ "status": 502, "message": "Cannot create folder \"sites/<sitename/Lists/<listname>/Attachments/5\".", "source": "https://<domain><sitename>/_api/web/folders/add('/sites/<sitename>/Lists/<listname>/Attachments/5')", "errors": [ "-2130247165" ]
New Member

it can save the attachement files to existing folders.

It seems the problem is that if the folder doesn't exist, the it can't create it.


eg. my structure is:

/List/myList/Attachments/2 - save files ok

but trying to save to /List/myList/Attachments/5 - fails


I was able to dynamically create folders based upon the subject of the email: New Folder/[Subject]


There does appear to be a problem with files over a certain size.  There is another thread about that issue.  The original poster had issues when the file size was greater than 90kb.


How did you create the folder?


And is it a folder under the "Attachments" folder?



I will look into the filesize issue



I ran into a similar issue.  I initially created a SharePoint 2013 workflow that fired on item creation to create an attachment generating the proper "attachments/[ID]" folder and then deleted the attachment.  This hacked worked for a little bit but it can easily run into timing issues and can be confusing for end users.


[Method: Post] Webservice call:  _api/web/lists/GetByTitle('LISTNAME')/items([%Current Item:ID%])/AttachmentFiles/add(FileName='file.txt')


[Method: Delete] Webservice call: _api/web/lists/GetByTitle('LISTNAME')/items([%Current Item:ID%])/AttachmentFiles/getByFileName('file.txt')


After attempting to add a delay between List Item Creation and Create File attachment, I can no longer get attachments to work.


Hi everyone,

I've just created my first flow using this template and I have a problem with attachments with the same name : if I already have a file named X.pdf and I received a new email with an attachment named X.pdf, the flow is overwrtiting the first file (I can see it in the versionning of Sharepoint)...

So I would like to add a date/time stamp in the filename but it failed every time when I am adding another field in "file name" than "Name"... Did someone know how to do that ?


In fact, I would like to use this flow in order to receive PDF orders and I don't want to miss one order if it has the same name !




Helpful resources

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.

Top Solution Authors
Top Kudoed Authors
Users online (1,063)