Finding subsites from the complete sharepoint url path

Sanjay Kumar R 81 Reputation points
2021-07-02T12:24:29.187+00:00

Hi,

I am trying to upload a document to SharePoint federated server and managed servers using curl.

My url will look like,

SharePoint Federated server url : https://abc.domain.com/teams/subsites/Documents/

SharePoint managed server url : https://abcd.domain.com/Documents/test

In order to get the request digest value, we need to send request to _api/contextinfo with full site url(root site + subsite). Is there any way to find whether the given SharePoint path has subsites programmatically?

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,565 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
2,655 questions
0 comments No comments
{count} votes

Accepted answer
  1. MichaelHan-MSFT 18,016 Reputation points
    2021-07-05T06:43:26.707+00:00

    Hi @Sanjay Kumar R ,

    You don't need to find the subsites, use the complete sharepoint url path to send request to _api/contextinfo also works. Like the below:

    https://abc.domain.com/teams/subsites/Documents/_api/contextinfo  
    

    Below is my test in PostMan:

    111774-image.png

    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.


0 additional answers

Sort by: Most helpful