4 Ways to Check SharePoint Site ID

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.

  1. Login to your Office 365 account (tenant)
  2. Click on the App launcher at the top right corner of the page.
  1. 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.

https://yourdomain.sharepoint.com/sites/yoursite/
  1. To access the site ID, use the construction, and add /_api/site to your SharePoint URL as Shown.
  2. Click Enter on your keyboard.

This will display the content of your site collection.

  1. To get the Site ID, on your keyboard, Click on Ctrl + F and a display box will pop up.
  2. On the display box, type d:id and click on Enter on your keyboard.

This will display the site ID of your site. The site ID is the alphanumeric number inside the d:id tag.

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:

  1. Login to your Office 365 account (tenant)
  2. Click on the App launcher at the top left corner.
  3. 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.

  1. 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.

  1. On Start from blank, click on Instant cloud flow. This allows you to start an automated trigger manually to get your SharePoint Site ID.
  1. A Build an instant cloud flow dialog box pops up, click on Manually trigger a flow
  2. Click on Create to start a manual trigger.

This will open a new page to create a trigger flow.

  1. Click on the New step below the Manually trigger a flow.
  1. 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.
  2. 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.

  1. 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.

  1. Click on Save after filling in the different fields. This will save your trigger.
  1. Click on Test at the upper right corner of the app.
  1. On the Test Flow panel, click on Manually.
  2. 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.

  1. Click on Continue in the Run Flow Panel
  2. Click on Run Flow

This will run the flow and a dialog box pops up that the flow is complete.

  1. 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"
  1. 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/"
  1. 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.

$Cred= Get-Credential
  1. 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)
  1. 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.

$Ctx.Load($Ctx.Site)
  1. Load your SharePoint Site

Enter the command on your PowerShell and click on Enter on your keyboard.

$Ctx.ExecuteQuery()

  1. Execute the query to fetch data from your SharePoint. This retrieves the SharePoint site ID
Write-host -f Green "Site ID:" $Ctx.Site.Id
  1. 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.

  1. Open PowerShell
  2. Copy and paste the script into PowerShell.
  3. Replace the URL with your actual site collection URL.
  4. 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.

  1. Login to your Graph Explorer to get SharePoint details.
https://graph.microsoft.com/v1.0/sites?search=yoursite
  1. On the home screen enter the above URL and replace yoursite with the SharePoint site you want to check the ID.
  2. 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:

https://graph.microsoft.com/v1.0/sites?search=*

This will display the details of all your SharePoint site including the IDs of each site available in your tenant.

Conclusions

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.

About the Author

Durojaye Olusegun

Durojaye Olusegun

Durojaye is a cybersecurity professional and data analyst with a knack for distilling complex technical information into simple, digestible guides. His diverse skill set not only covers the intricate world of cybersecurity but also delves into the realm of Microsoft 365 tools. Whether he's crafting informative blog posts or engaging social media content, or staying updated on the latest trends in his field, Durojaye always brings a unique perspective to his work.

Related Articles

Comments

0 Comments

Get the Latest Tech Tips

Write For Us

Are you a tech enthusiast with a talent for writing great content? Come write for us!

Follow Us

Follow us on social media to stay up to date with the latest in tech!