cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
GonzaloR
Advocate II
Advocate II

Updating a Document set with HTTP request to SharePoint - 404 File not found error

I am using the Karine Bosch approach to creating and updating a document set in SharePoint through an HTTP Request. Its been working fine, until recently it started throwing an error with one of my libraries when updating the metadata. My flow continues to create the doc set in the same library, and I can successfully find the doc set with a GET request. But when I go to update it gives me a 404 File not Found error.

 

I've already tried:

  1. PUT request (invalid for SP.Data type)
  2. POST with PATCH method (404)
  3. I've verified the SP.Data full name (ListItemEntityTypeFullName)
  4. Verified account permissions to the target library 
  5. duplicated the entire flow (404)
  6. Added a new connection (404)
  7. Created a manually triggered flow with an action from scratch (404)

Any suggestions are welcome!

 

POST REQUEST

 image.png

 

Response Body (ERROR)

 

 

 

 

{
  "status": 404,
  "message": "File Not Found.\r\nclientRequestId: 37532ce1-21e0-4277-85ad-f3d106c51da3\r\nserviceRequestId: bd8b449f-00cc-a000-8b77-7b0519dacfb8",
  "source": "https://contoso.sharepoint.com/sites/CORPClientProjects/_api/web/lists/getbytitle('Project%20Files')/items(701)",
  "errors": [
    "-2147024894",
    "System.IO.FileNotFoundException"
  ]
}

 

 

 

Thanks,

 

1 ACCEPTED SOLUTION

Accepted Solutions
GonzaloR
Advocate II
Advocate II

I found the problem.

Power Automate's error message is misleading. The error was not in fact a 404 (File not found).

The error was actually in the body of the request. This HTTP Post request updates the FileLeafRef (file name) field in a sharepoint item in the library. And the new name had a space character as the last character in the string, as it was entered by the user triggering the flow. Like this:

"New File Name April 2020 "

Instead of giving me some kind of malformed request body error, it gave me a 404. This was misleading and had me looking in all the wrong places.  I hope this helps someone else!

 

To resolve the file name error I enclosed it in a Trim() function, this removes extra spaces at the beginning and end of the string.

View solution in original post

1 REPLY 1
GonzaloR
Advocate II
Advocate II

I found the problem.

Power Automate's error message is misleading. The error was not in fact a 404 (File not found).

The error was actually in the body of the request. This HTTP Post request updates the FileLeafRef (file name) field in a sharepoint item in the library. And the new name had a space character as the last character in the string, as it was entered by the user triggering the flow. Like this:

"New File Name April 2020 "

Instead of giving me some kind of malformed request body error, it gave me a 404. This was misleading and had me looking in all the wrong places.  I hope this helps someone else!

 

To resolve the file name error I enclosed it in a Trim() function, this removes extra spaces at the beginning and end of the string.

View solution in original post

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!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Users online (2,984)