Forum Discussion

AmitGogia's avatar
AmitGogia
Copper Contributor
Jun 17, 2020

File Upload in sharepoint Online

Hi All,

I need to upload a simple text file in SharepointOnline. While trying to import the file through Postman, I am getting the error as "Could not get response".

 

Request  help for the case.

  • AmitGogia :

    1) Hope you are not missing any of the steps below:

    POST https://{site_url}/_api/web/GetFolderByServerRelativeUrl('/Folder Name')/Files/add(url='a.txt',overwrite=true)

    Authorization: "Bearer " + accessToken

    Content-Length: {length of request body as integer}

    X-RequestDigest: "{form_digest_value}"

     

    To get the access token please follow each steps as per given in below blog(written by me):

    https://techcommunity.microsoft.com/t5/microsoft-365/setting-for-sharepoint-online-to-access-through-external-network/m-p/1423477

     

    2) Also check if your settings for the POSTMAN tool as per below:

    setting ->general -> Requesttimeout in ms = 0 

    • AmitGogia's avatar
      AmitGogia
      Copper Contributor

      Since I am new to sharepoint and might have done something wrong. Hence, I am writing the steps that are performed:

      1. API that is build: Site/_api/web/GetFolderByServerRelativeUrl('/Folder name')/Files/add(url='abc.txt',overwrite=true)

      2. Authorization, Content length and X-RequestDigest values are passed.

      3. File is added in the body header.

       

      Pls let me know in case something is wrong.

      • Ricardo Viana's avatar
        Ricardo Viana
        Steel Contributor
        That is correct, is the folder already created?

        Sorry, I have no idea why it is failing

Resources