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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Copilot Studio / Copilot Agent with Sha...
Copilot Studio
Suggested Answer

Copilot Agent with Sharepoint HTTP REST api tool.

(1) ShareShare
ReportReport
Posted on by 4
I am having trouble trying to configure a bot for our sharepoint site. I have created the bot, explained to it the structure of the site, given we use document sets and content types, i have explained those as well  and given it the content type IDs. Since it does not seem able to access metadata by default, I have added a tool for the "Send an HTTP request to Sharepoint". This is something I have used a lot in logic apps since we can't use the standard actions and it works fine there, even if its a little sparse on error feedback.
 
The problem is, once I configure the tool for the agent, I can ask it if it now has access to read the metadata and it replies yes. When I ask it something straight forward like, count the amount of items, I get the following error:
 
Error Message: Evaluating PowerFx expression resulted in error while invoking the connector : PVA.HttpRequest failed: JsonReaderException '0x1F' is an invalid start of a value. LineNumber: 0 | BytePositionInLine: 0. Error Code: ConnectorPowerFxError

I have been troubleshooting this for quite a while. I have tired custom hard set values of the URI, the Method, the headers and its 12 different ways of taking the same JSON string for the header, with and without brackets, on the same line or not on the same line. Everything I try error  causes it to complain its missing JSON when its not, or sends me straight back to the 0x1F error.
 
Obviously something between these processes is failing, the agent or tool can't understand the response and complains about this invisible character.
 
Has anyone else come across this or knows how I can get this to work properly? 
 
I have the same question (0)
  • Suggested answer
    Sam_Fawzi Profile Picture
    917 Super User 2026 Season 1 on at
     
    Try to set headers explicitly like this in your "Send an HTTP request to SharePoint" :
     
    {
      "Accept": "application/json;odata=nometadata",
      "Content-Type": "application/json;odata=nometadata",
      "Accept-Encoding": "identity"
    }
  • Suggested answer
    Ricardo D. Souza Profile Picture
    6 on at
    Are you using a PowerFX formula to define the site address? If so, I suggest that you use a fixed url to validate if the connection with Sharepoint is being executed correctly. And if it works, fix the PowerFX formula.
     
    It´s kind hard to troubleshoot this kind of issue on Copilot Studio. I recommend that you create a Power Automate flow to validate connection and understand the response. 
     
  • SM-12030647-0 Profile Picture
    2 on at
    Experiencing a similar issue here with the "Send an HTTP request to SharePoint" tool. I am using this for  GET request and my headers are set to 
    {
      "Accept": "application/json;odata=nometadata",
      "Accept-Encoding": "identity"
    }

    I have even tried 


    {
      "Accept": "application/json;odata=nometadata",
      "Content-Type": "application/json;odata=nometadata",
      "Accept-Encoding": "identity"
    }

    Both result in the same error : 
    "
    connectorPowerFxErrorEvaluating PowerFx expression resulted in error while invoking the connector : PVA.HttpRequest failed: JsonReaderException '0x1F' is an invalid start of a value. LineNumber: 0 | BytePositionInLine: 0."
     
    Bear in mind this HTTP request works just fine with idenitcal config when run in Power Automate, so I suspect this may just be a Copilot Studio issue. 

    Has anyone managed to resolve this?
  • Sam_Fawzi Profile Picture
    917 Super User 2026 Season 1 on at
     
    If the exact same request works in Power Automate but fails when called from the Copilot Studio HTTP tool, it’s very likely not the SharePoint REST call itself but how Copilot Studio is parsing the response.
     
    The 0x1F error usually means the tool is receiving something it can’t parse as JSON (often compression/encoding or a response formatting issue).
     
    A couple things to try:
    • For GET requests, remove Content-Type and keep only:
    {
      "Accept": "application/json;odata=nometadata",
      "Accept-Encoding": "identity"
    }
     
    Test with a very simple endpoint like:
    _api/web?$select=Title
     
    If it still fails, the most reliable workaround is to wrap the SharePoint call in a Power Automate flow and have the agent call the flow instead. Power Automate handles the response parsing much more reliably.
     
    Since it works in Power Automate with the same config, this may just be a Copilot Studio tool limitation/bug.
  • Doug P Profile Picture
    4 on at
    I have gone in somewhat of a circle. Since first reporting this, the bot is now able to read metadata (likely recent updates) and I can create and update items in the document set items by adding the tool. Now I want to create a folder and change its content type. When using tools like update item, it fails and copilot says this is because the update item does not support updating the content type id. Fair enough, so I re added the SendHTTPtoSharepoint tool as the agent says that will work to do it and now I'm back to the original error 0x1F.
     
    I think you are right Sam in that it is a bug between copilot's agent and it not understanding/parsing the json properly and the two sides get hung up.
     
    Before I go to hassle of creating a workflow just to update content types,  does anyone know of a way/sharepoint tool in copilot studio that will allow for me to do that. e.g. make folder, change content type of folder from default to something else.

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Copilot Studio

#1
Valantis Profile Picture

Valantis 277

#2
11manish Profile Picture

11manish 206

#3
sannavajjala87 Profile Picture

sannavajjala87 156 Super User 2026 Season 1

Last 30 days Overall leaderboard