Robcarter10
asked on
How to get library id from sharepoint site in order to sync using Intune
I am trying to automatically sync a few sharepoint document libraries using the Administrative Templates in Microsoft Intune. All of the instructions that I have found have said to go to the document library, click sync and the click the option to copy the library id. However, that option does not appear for me even though I am a global admin. I contacted Microsoft support and they could not tell me why I did not have that option. I was told how to find the library id but I think there is more than that which is copied from it based on what I have read. I would appreciate if someone could either tell me how to get the option to copy the library id to appear or how I can retrieve the information another way. I already tried just placing the library id in the administrative template but that did not work.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Zvonko זְאֵב- The first link that you included solved my problem. I searched for days and never found that post. Thanks for your help!
You are welcome : )
Only to complete this I have copied the PowerShell source from here:
https://gist.githubusercontent.com/win2000b/5ad0c973a36ecc5458dcdd6a469a142c/raw/a4db147f439f028cc03f72120f82434bd24f1f08/GetLibraryID.ps1
https://gist.githubusercontent.com/win2000b/5ad0c973a36ecc5458dcdd6a469a142c/raw/a4db147f439f028cc03f72120f82434bd24f1f08/GetLibraryID.ps1
# Optional, To get your tenant ID via PowerShell
Connect-msolservice
Get-MSOLCompanyInformation | select objectID
# Install SharePoint PowerShell If needed
Install-Module SharePointPnPPowerShellOnline
# Example https://$tenant.sharepoint.com/sites/$siteName
$tenant = 'Enter your Tenant Name in Here' # xxxx.onmicrosoft.com
$tenantId = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' #Tenant ID, can be retrieved from Azure AD or PowerShell under optional.
$siteName = 'sales' #Sharepoint site name
$docLib = 'Enquiries' #Sharepoint Document Library
# Connection
Connect-PnPOnline https://$tenant.sharepoint.com/sites/$siteName -SPOManagementShell
# If you do not have MDA or modern auth then do not use the -SPOManagementShell switch
Connect-PnPOnline https://$tenant.sharepoint.com/sites/$siteName
# Convert Tenant ID
$tenantId = $tenantId -replace '-','%2D'
# Convert Site ID
$PnPSite = Get-PnPSite -Includes Id | select id
$PnPSite = $PnPSite.Id -replace '-','%2D'
$PnPSite = '%7B' + $PnPSite + '%7D'
# Convert Web ID
$PnPWeb = Get-PnPWeb -Includes Id | select id
$PnPWeb = $PnPWeb.Id -replace '-','%2D'
$PnPWeb = '%7B' + $PnPWeb + '%7D'
# Convert List ID
$PnPList = Get-PnPList $docLib -Includes Id | select id
$PnPList = $PnPList.Id -replace '-','%2D'
$PnPList = '%7B' + $PnPList + '%7D'
$PnPList = $PnPList.toUpper()
# Enumerate the Full URL
$FULLURL = 'tenantId=' + $tenantId + '&siteId=' + $PnPSite + '&webId=' + $PnPWeb + '&listId=' + $PnPList + '&webUrl=https%3A%2F%2F' + $tenant + '%2Esharepoint%2Ecom%2Fsites%2F' + $siteName + '&version=1'
# Output the FULL URL To Copy and Paste
Write-Output 'List ID: ' $FULLURL
ASKER