Office365-REST-Python-Client icon indicating copy to clipboard operation
Office365-REST-Python-Client copied to clipboard

Upload file crashes

Open davidjitca opened this issue 4 months ago • 0 comments

Hello, I am using this repo, that is used as a library in an MCP connector to control sharepoint from an agent.

I still have an error:

"400 Client Error: Bad Request for url: <>_api/web/getFileByServerRelativePath%28DecodedUrl%3D%27/Shared%20Documents/Folder%201/conversation.docx%27%29/%5C%24value"\n}”
}, 

And I understand that this is error is because of this line in the library, in file.py

url = quote(
            r"{0}/web/getFileByServerRelativePath(DecodedUrl='{1}')/\$value".format(
                context.service_root_url, decoded_server_relative_url
            ),
            safe=":/",
        )

Because of quoting also the first part, gpt is saying that only decoded_server_relative_url should be quoted. I let a comment also on the issue https://github.com/vgrem/office365-rest-python-client/issues/923.

Can you help me?

davidjitca avatar Aug 01 '25 08:08 davidjitca