Forum Discussion
jbtzz
Mar 21, 2023Brass Contributor
Identify site columns in lists
Good day, Is there a way to know which columns in a list are actually site columns and not "locally" created list columns?
- Mar 22, 2023
I figured it out by using PowerShell PnP:
#Parameters $SiteURL = "https://YourDomain.sharepoint.com/sites/YourSite" $ListName = "YourListName" #Connect to source SharePoint Connect-PnPOnline -Url $SiteURL -Interactive #Get list and site columns to compare Ids $ListFields = Get-PnPField -List $ListName $SiteFields = Get-PnPField Foreach($l in $ListFields | where {$_.Hidden -eq $false}){ $counter = 0 Foreach($s in $SiteFields){ if($l.Id -eq $s.Id) { echo "$($l.Title) (Internal name: $($l.InternalName)) is a SITE COLUMN" $counter++ } } if($counter -eq 0){ echo "$($l.Title) (Internal name: $($l.InternalName)) is a LIST COLUMN" } }
jbtzz
Mar 21, 2023Brass Contributor
Thanks for the quick reply.
Unfortunately, that doesn't work. I imported a site column to the list and created another column locally. Both have the same behavior, and I can edit the site column from the content type screen you showed.
Unfortunately, that doesn't work. I imported a site column to the list and created another column locally. Both have the same behavior, and I can edit the site column from the content type screen you showed.
Deleted
Mar 22, 2023
Another way to identify site columns in lists is by using the name of the column.
But the best way is
- If it's a site column you will be able to use it on other lists
- If it's a list column, it's only limited to that list, you can't use it on other lists
If I have answered your question, please mark your post as Solved If you like my response, please give it a Like Appreciate your Kudos! Proud to contribute! 🙂 |
- jbtzzMar 22, 2023Brass ContributorHi,
Just looking at the internal name of the column doesn't work. I can have a site column and a list column with the same name if they're in separate lists.