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.

Helpful resources

Announcements
October Events

Mark Your Calendars

So many events happening this month - don't miss out!

 WHAT’S NEXT AT MICROSOFT IGNITE 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Users online (3,435)