Do you need the SharePoint site ID?
The SharePoint Site ID uniquely identifies each site. Whether you’re a SharePoint administrator or developer finding this unique identifier can be a challenge.
When developing bespoke solutions or linking external systems with SharePoint, the SharePoint site ID can come in handy. It allows for the programmatic reference of a specific site.
In this post, we’ll explore the SharePoint Site ID and where it can be found.
What is SharePoint Site ID?
A SharePoint Site ID is a Globally Unique Identifier (GUID), which is a unique alphanumeric string assigned to every SharePoint site. It helps in identifying each SharePoint site uniquely across the entire SharePoint environment.
This ID is automatically generated by SharePoint when a new site is created and it remains the same throughout the life of the site, even if the site is moved or its URL is changed.
📒Read More: Check out this post on how to create a GUID in Power Automate.
The SharePoint site ID might be used when developing custom solutions or integrating external systems with SharePoint. The Site ID can be used to reference a specific site programmatically.
Check SharePoint Site ID from the Site Settings
One of the methods of checking your SharePoint site ID is from the site settings. This method offers a convenient and straightforward way to check your SharePoint site ID. To check your SharePoint site ID from setting, follow these steps.
- Login to your Office 365 account (tenant)
- Click on the App launcher at the top right corner of the page.
- Click on the SharePoint App and this will redirect you to your SharePoint App where all your SharePoint sites are found.
Also, you can search SharePoint on the home page of your Office 365 to navigate to your SharePoint site.
Now that you’re on the SharePoint site of your choice, check the URL, it will look like this.
- To access the site ID, use the construction, and add
/_api/siteto your SharePoint URL as Shown.
- Click Enter on your keyboard.
This will display the content of your site collection.
- To get the Site ID, on your keyboard, Click on Ctrl + F and a display box will pop up.
- On the display box, type
d:idand click on Enter on your keyboard.
This will display the site ID of your site. The site ID is the alphanumeric number inside the
Check SharePoint ID with Power Automate
Power Automate, formerly known as Microsoft Flow, is a powerful tool that allows you to automate tasks and workflows within your SharePoint environment, making it an efficient way to check your SharePoint Site ID. It offers a seamless way to automate tasks, trigger actions, and bring efficiency to your SharePoint environment. As for our focus on uncovering the SharePoint Site ID, Power Automate simplifies the process. You can set up flows that fetch this unique identifier and use it as a cornerstone for automating actions within your SharePoint environment.
So, whether you’re new to the world of workflow automation or an experienced user, Power Automate can be your trusty sidekick in the quest for streamlining tasks and making your SharePoint experience more efficient.
Before you start using Power Automate, ensure that you have the necessary permissions and access to the SharePoint site for which you want to get the Site ID.
Follow these steps to use Power Automate to check your Site ID:
- Login to your Office 365 account (tenant)
- Click on the App launcher at the top left corner.
- Click on Power Automate.
If you do not see Power Automate, on the home page of your Office 365 account, search for Power Automate and click on Enter on your keyboard.
- On the home page of Power Automate, click on Create at the left corner of your app to start building a new flow.
It will direct you to a new different page.
- On Start from blank, click on Instant cloud flow. This allows you to start an automated trigger manually to get your SharePoint Site ID.
- A Build an instant cloud flow dialog box pops up, click on Manually trigger a flow
- Click on Create to start a manual trigger.
This will open a new page to create a trigger flow.
- Click on the New step below the Manually trigger a flow.
- A choose an operation dialog box appears. In the search field, search for SharePoint. This is because you want to create an automated trigger in SharePoint. After searching, click on Enter on your keyboard.
- Under the Action, click on send an HTTP request to SharePoint. This will enable you to add the trigger.
This will display a send an HTTP request to the SharePoint dialog box. This dialog box consists of different fields to be filled in other to make a request to SharePoint to retrieve the site ID.
- To access a specific site, use the following construction.
Site Address: https://yourdomain.sharepoint.com/sites/yoursite/ Uri: _api/site Headers key: Accept Header value: application/json;odata=nometadata
Replace the above URL with your actual SharePoint site URL. The
_api/site is the REST API of SharePoint to access a SharePoint site details.
- Click on Save after filling in the different fields. This will save your trigger.
- Click on Test at the upper right corner of the app.
- On the Test Flow panel, click on Manually.
- Click on Test. You will see a green check at the top of the screen.
A Run flow panel pops up. This panel shows the SharePoint owner.
- Click on Continue in the Run Flow Panel
- Click on Run Flow
This will run the flow and a dialog box pops up that the flow is complete.
- Now Click on Send an HTTP request to SharePoint and scroll down to the body, you will see “Id” in the json response. The alphanumeric is your Site ID.
Check SharePoint Site ID with Power Shell
Checking your SharePoint Site ID is a breeze with PowerShell, and it’s particularly useful for those who prefer command-line efficiency.
Before you begin using PowerShell, it’s essential to have administrative access to your SharePoint environment. This elevated level of access allows you to execute commands that can influence site configuration, data management, and access control.
To get the SharePoint site ID, use the following PowerShell code.
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll" Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
- Load SharePoint CSOM Assemblies
These assembles provide the required functions and methods for interacting with SharePoint. After writing this command on your PowerShell, click on Enter on your keyboard.
$SiteURL = "https://yourdomain.sharepoint.com/sites/yoursite/"
- Set the SharePoint URL and credentials.
Make sure you use the URL of the site you want to check the site ID for. After setting the URL, press Enter on your Keyboard.
- Login with your administrative credentials
After entering this command, it prompts you to provide your credentials, provide your administrative credentials, and Click on Enter on your keyboard.
$Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
- Set up the Context
This command creates a new Client Context object to establish a connection to the SharePoint site using the URL and credentials. Replace SiteURL with your SharePoint site URL.
- Load your SharePoint Site
Enter the command on your PowerShell and click on Enter on your keyboard.
- Execute the query to fetch data from your SharePoint. This retrieves the SharePoint site ID
Write-host -f Green "Site ID:" $Ctx.Site.Id
- The command displays the site ID to the console afterward.
By following these step-by-step instructions, you can use the provided PowerShell code to connect to a SharePoint site, retrieve its Site ID, and display it on the console. This information can be valuable for various administrative and management tasks in your SharePoint environment.
You can also use the SharePoint Online Management Shell. To retrieve your SharePoint Site ID, you can use the following PowerShell script. Please note that you’ll need to have the necessary permissions to run PowerShell commands on your SharePoint environment.
# Connect to SharePoint Connect-PnPOnline -Url "https://yourdomain.sharepoint.com/sites/yoursite/" -UseWebLogin # Get the Site ID $site = Get-PnPTenantSite -Detailed $site.Id
Replace the URL with the actual URL of your SharePoint site. This PowerShell script connects to your SharePoint site collection and retrieves the Site ID.
Here is how to use it.
- Open PowerShell
- Copy and paste the script into PowerShell.
- Replace the URL with your actual site collection URL.
- Run the script.
Check SharePoint Site ID with Graph API
The Microsoft Graph API offers a powerful and versatile way to interact with SharePoint, whether it’s to fetch data, automate processes, or gather specific information about your SharePoint site, such as the Site ID. Let’s explore how to check your SharePoint site using the Graph API.
📝 Note: Ensure you have the necessary permissions and access to the SharePoint site you want to query.
- Login to your Graph Explorer to get SharePoint details.
- On the home screen enter the above URL and replace yoursite with the SharePoint site you want to check the ID.
- Click on Run query.
On the response preview, you will see different information about your SharePoint site including the Site ID.
To check the ID of all your SharePoint site, use the URL:
This will display the details of all your SharePoint site including the IDs of each site available in your tenant.
Knowing your way around your SharePoint site IDs is undeniably pivotal as a developer or administrator.
These unique identifiers serve as the backbone of your SharePoint site architecture, helping you navigate and control your sites programmatically and efficiently.
Throughout this guide, we’ve explored four different key methods to check your SharePoint site ID, from the user-friendly web interface to more advanced methods such as power automate, PowerShell and Graph API.
By harnessing the knowledge of these identifiers, you empower yourself to take control of your SharePoint sites.