web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Send HTTP request to u...
Power Automate
Unanswered

Send HTTP request to update file content of PDF in SharePoint

(0) ShareShare
ReportReport
Posted on by 92

Hello,

 

I have a http request which renames the file. That is fine. But I've used Encodian to change some text within my PDF and I want to update the existing file.

 

I worked through endless errors and finally I am stuck at the error of "The property 'content' does not exist on type 'SP.Data.Shared_x0020_DocumentsItem'. Make sure to only use property names that are defined by the type."

 

Update: just realised I didn't return my " '__metadata':
{'type':'SP.Data.Shared_x0020_DocumentsItem'}, " back into the body. I have now.

 

I looked at the schema for the file and it's definitely 'content', I even tried '$content' just in case. I've tried all manner of things for the content-type and content but in the screenshot is just the final area I arrived at. I've exhausted my limited JSON knowledge at this point. The 'Output' for the content is the File Content from Encodian wrapped in base64()

Selom_1-1714150202255.png

 

Thanks for any help!

 

Before the file rename happens, I have a condition that checks if the renamed version of the file already exists. If yes, it uses  the regular SharePoint connectors for updating a file, but if no, I could only get it to work via the HTTP request. So that's why I'm not using the SharePoint connectors for this.

Categories:
I have the same question (0)
  • SK-26021054-0 Profile Picture
    92 on at
    Re: Send HTTP request to update file content of PDF in SharePoint

    Now I get the error message "A 'PrimitiveValue' node with non-null value was found when trying to read the value of a navigation property; however, a 'StartArray' node, a 'StartObject' node, or a 'PrimitiveValue' node with null value was expected.".

     

    For clarity, I changed the Base64 Compose to a Base64 to Binary output from a string variable.

  • ServicePA Profile Picture
    7 on at
    Re: Send HTTP request to update file content of PDF in SharePoint

    Is there already a solution?

     

    I'm also playing around with it. Maybe we get to a conclusion together.

     

    The problem why I need this is, that the action "Update File" kicks out my DocumentID, which is a self-created column, but no other metadata. So I am trying to update the file content via HTTP Request.

     

    First of all I use the action "Get File Content" to get the file content which should override my other file's content:

     

    Get File Content:

    URL: <Your SharePoint site>

    Identifier: <Identifier of your file you want the content of>

     

     

    Then I use a HTTP request trying to update my other file's content:

    URL: <your SharePoint site>

    Method: PUT

    URI: _api/web/GetFileByServerRelativeUrl('/sites/Processdocuments/Shared_Documents/<Filename with extension>')/$value

    Header: { "Accept": "application/json;odata=verbose", "Content-Type": "application/octet-stream", "IF-MATCH": "*" }

    body: <Dynamic content for file content from "Get File Content" Action>

     

    I heard that you can also use POST method but then you need to add "X-HTTP-Method": "PUT" to your headers.

     

    The output of the dynamic content is exactly what you wrote by hand:

    {
      "$content-type""application/pdf",
      "$content""<binary stuff>"
    }

     

    There's only one difference: The dollar signs in front of the "content".

     

    The HTTP Request isn't throwing any errors, but it doesn't update my file content.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Tomac Profile Picture

Tomac 532 Moderator

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 461 Super User 2025 Season 2

#3
chiaraalina Profile Picture

chiaraalina 256

Last 30 days Overall leaderboard