question

Srikanth-8498 avatar image
0 Votes"
Srikanth-8498 asked IbrarAhmad-1741 edited

Creating Folder in Sharepoint Site from Postman

Hi All,

We're trying to create a folder in the SharePoint from third party system with the help of the below link, prior to that we are trying it from Postman, but the call takes about a minute with out any response.

https://docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-folders-and-files-with-rest

Step 1: Get the access token (Bearer token)
Step 2: Using the Step 1 token get the X-RequestDigest value.


191110-picture-1.png

Step 3: Using the Step 1 token and Step 2 "FormDigestValue" preparing the next call to Create a folder in SharePoint.
a. Header Info
191232-picture-2.png
b. Body
191241-picture-3.png
Step 3 Call response: "Could not get response".

Is there any issue in the call? Can you please give us any direction to resolve this issue.
Appreciate your help. Thanks you


sharepoint-devpartner-center-api
picture-1.png (70.2 KiB)
picture-2.png (36.4 KiB)
picture-3.png (17.8 KiB)
picture-1.png (70.2 KiB)
picture-2.png (36.4 KiB)
picture-3.png (17.8 KiB)
5 |1600 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.

TongZhangMSFT-7548 avatar image
1 Vote"
TongZhangMSFT-7548 answered TongZhangMSFT-7548 commented

Hi @Srikanth-8498,
According to my research and testing, you can try to create Folder in SharePoint site using postman according to the following steps.
Hope it can help you, thanks for your understanding and support.

Steps:
1.get "Access_token";
2.

POST https://xxxx.sharepoint.com/sites/xxxxx/_api/web/folders
Authorization: "Bearer " + accessToken
Accept: "application/json;odata=verbose"
Content-Type: "application/json;odata=verbose"

191080-image.png

3.Input the following script in the body:

{
"__metadata": {
"type": "SP.Folder"
},
"ServerRelativeUrl": "https://xxxx.sharepoint.com/sites/xxxxx/test/folder"
}

191147-image.png


4.Click " Send", and the folder is created successfully.
191146-image.png


-------------------------------Update-------------------------------
Please follow these steps to create a folder in SharePoint, and check if there are any missing steps:
1.Follow the steps in the documentation to get the "Access_token" (as shown in the following screenshot).
194199-image.png

2.Copy the "Access_token" to "Authorization". And input "URL" , "Headers" and "Body"

POST https://xxxx.sharepoint.com/sites/xxxxx/_api/web/folders
Authorization: "Bearer " + accessToken
Accept: "application/json;odata=verbose"
Content-Type: "application/json;odata=verbose"
Content-Length: "148"

 {
   "__metadata": {
     "type": "SP.Folder"
   },
   "ServerRelativeUrl": "https://xxxxx.sharepoint.com/sites/xxxx/test/newfolder1"
 }

194237-image.png
194239-image.png

My test results:
194170-image.png

Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure that you completely understand the risk before retrieving any suggestions from the above link.


If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
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.






image.png (49.6 KiB)
image.png (41.0 KiB)
image.png (6.0 KiB)
image.png (105.7 KiB)
image.png (97.4 KiB)
image.png (27.8 KiB)
image.png (4.0 KiB)
· 9
5 |1600 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.

@TongZhangMSFT-7548,
Appreciate your response. The only difference in my call is Content-Length( It was errored out without "Content-Length" ). Still the POST call could not create a folder. Please let me know if i am missing anything here. Thank you

191164-image.png


Script in the Body
191150-image.png


0 Votes 0 ·
image.png (85.1 KiB)
image.png (8.4 KiB)

Hi @Srikanth-8498,
Please try to reacquire "Access_token" ,here is a document about get 'Access_token' you can refer to.

Reference:
https://global-sharepoint.com/sharepoint-online/in-4-steps-access-sharepoint-online-data-using-postman-tool/

If possible, can you share the error message "without 'Content-Length' "?

Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure that you completely understand the risk before retrieving any suggestions from the above link.





0 Votes 0 ·
Srikanth-8498 avatar image Srikanth-8498 TongZhangMSFT-7548 ·

@TongZhangMSFT-7548

Here is the error message if i don't maintain the 'Content-Length'. We do not have any issue with the 'Access Key' as we are able to create the files in the Share point site. The issue is only with the folder creation.
191417-image.png



I have used new key as well.

0 Votes 0 ·
image.png (32.6 KiB)
Show more comments
IbrarAhmad-1741 avatar image
0 Votes"
IbrarAhmad-1741 answered IbrarAhmad-1741 edited

Hi @TongZhangMSFT-7548,
I am facing issue in contextinfo, Can you help me?

234378-image.png


234491-contextinfo1.png

Thank You



image.png (41.9 KiB)
contextinfo1.png (73.0 KiB)
5 |1600 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.