question

SanjayKumarR-0334 avatar image
0 Votes"
SanjayKumarR-0334 asked ·

SharePoint Online: Uploading file using FrontPage Server Extenstion Put document method

Hi,

I am trying to upload a file to SharePoint server using FrontPage Server Extenstion Put document method. I followed the below document,

https://docs.microsoft.com/en-us/previous-versions/office/developer/sharepoint-2010/ms479623(v=office.14)

I am able to create the file successfully on the SharePoint using libcurl and postman, but I am not sure how to pass the file content in the body. Could anyone guide me how to do it?

Regards,
Sanjay


office-sharepoint-online
· 12
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @SanjayKumarR-0334 ,

Is there any update ? Did the binary data in the body works to upload file into SharePoint ?

0 Votes 0 ·

Hi Jerry,

I tried with the steps shared by you. I am getting the below error,

"The security validation for this page is invalid. Click Back in your Web browser, refresh the page, and try your operation again."

I am sure my request digest is a valid one. I am able to create the file in SharePoint with the using RPC method.
72991-rpc-call.png


0 Votes 0 ·
rpc-call.png (54.2 KiB)

I am attaching the error screenshot here.72900-rest-api.png


0 Votes 0 ·
rest-api.png (40.1 KiB)
Jerryzy-MSFT avatar image Jerryzy-MSFT SanjayKumarR-0334 ·

Hi @SanjayKumarR-0334 ,

When uploading files, rtFa Cookie is no need to set, only X-RequestDigest is necessary, you could try to remove the Cookie in the capture above and then try again to see if it works.

Thanks
Best Regards

0 Votes 0 ·
Show more comments

@Jerryzy-MSFT Do you have any inputs on the above mentioned issue?

0 Votes 0 ·
Jerryzy-MSFT avatar image Jerryzy-MSFT SanjayKumarR-0334 ·

Hi @SanjayKumarR-0334 ,

The request digest value should be got with FedAuth and rtFa cookie like this in PostMan:

73314-snipaste-2021-03-02-14-54-15.png


And if your site url is https://tenant.sharepoint.com/teams/SharePointTest2, then url to get digest value should be:

https://tenant.sharepoint.com/teams/SharePointTest2/_api/contextinfo

Detailed steps to get digest value for authentication in PostMan, please refer this blog:

SharePoint Online remote authentication (and Doc upload)

Thanks
Best Regards

0 Votes 0 ·
Show more comments

1 Answer

Jerryzy-MSFT avatar image
0 Votes"
Jerryzy-MSFT answered ·

Hi @SanjayKumarR-0334 ,

The File Content in the request body should be the file binary stream data, in PostMan, you can select a specific file and will automatically convert as binary data, you can test it.

Here is the summary to upload a file:

 POST https://{site_url}/_api/web/GetFolderByServerRelativeUrl('/Folder Name')/Files/Add(url='{file_name}', overwrite=true)
 Authorization: "Bearer " + accessToken
 Content-Length: {length of request body as integer}
 X-RequestDigest: "{form_digest_value}"
    
 Contents of binary file

71978-snipaste-2021-02-25-15-38-31.png

And before uploading file, it's necessary to get request digest value and use as X-RequestDigest in request header, here is a blog with detailed steps, I suggest you can refer for detailed information:

SharePoint Online remote authentication (and Doc upload)

Thanks
Best Regards





If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.