There was a requirement I had back then to create a Java Application to work with SharePoint. In the beginning, I had no idea what SharePoint was and what the use of it. You can use SharePoint as a secure place to store, organize, manage, share and access information. It’s like a central place where organizations employees can access the content. A site is addressed by a unique identifier which is a composite ID. It composes of hostname, collection unique id, and the unique site id. Let’s see how we can use Microsoft Graph Explorer to find the Site Id of a SharePoint Site.
What is a SharePoint Site?
So, I had a requirement to upload some video and document files to a specific SharePoint site. A Site is a kind of website. In a SharePoint account, we can create more than one sites. So we call it site collection.
There are various things we can configure when we are creating a site.
- Web pages
- Content types
I’m not going to go into details about every feature. If you’re interested, read the Microsoft official documentation. You will get all the information from there. They have excellent documentation.
What is Graph Explorer?
Graph Explorer is a web-based tool that you can use to test API requests using Microsoft Graph APIs in a very convenient manner. You can play around with demo data in there. But if you need data about your tenant, then you have to sign in.
You can access Graph Explorer at:
How to use Graph Explorer?
- Sign in to the graph explorer
- Select the
HTTPmethod which you want to perform
- Select the version of API that you want to use, either
- Type the query in the request box
- Hit the Run Query
Then it will show the response of your query as
JSON data. Below image shows the all the steps above.
How to get a specific SharePoint Site id?
You might be wondering, why the heck I need site id? If you’ve come across accessing SharePoint data programmatically, then on the line, you will need a
site id. For various things. Such as uploading content, deleting them, moving them etc.
Below is the query for getting site id for your SharePoint account.
<sitename> with your hostname and sitename.
After executing the above query, it will give you the
id of your specific site. In the
JSON response, you will get a key as
id, then extract the value of
That value contains three-piece of data,
- SharePoint site id
- SharePoint web id – you don’t need this one
You only need the SharePoint Site id. Below is my query request response.
In this short tutorial, you learn about the Graph Explorer web tool. You can play around it. There are many graph APIs to play. On the left side of the graph explorer, you can see all the services it provides. Read this tutorial to get the practical usage of SharePoint Site Id.