I have come across this problem a few times now. You want to delete the site column and get an error like… You can’t delete this column because it is still in use. Or Fields associated to content types cannot be deleted. The main problem is that how do I know what site or list is using the column? Searching around the web I found a few suggestions however only one had a suggestion other than delete everything and start over or create everything new and leave the old as it is. However that one was using SQL queries directly against the SharePoint DBs and although it was only reads which is better then making writes directly it is still against Microsoft Support rules so I had to find another way.
PowerShell to the rescue! After doing a little digging it became apparently clear that it is actually very easy to find all instances of a site column within a site collection. The short little script that I will share today will look at every site and every list within a site collection and return the GUID for the site and list that it finds that column. This is great because now you can easily identify where the column is and go to those lists and remove it so that you can safely delete the site column. Better yet, we can pipe the results to a PowerShell cmdlet to remove the column all at once!
So here is what I used
First we get the site collection that contains the site column
$web = Get-SPWeb http://”sitecollectionurl”
then we get the column that we are looking for
$column = $web.Fields[“Column Display Name”]
Then we find where it is used
$column.ListsFieldUsedIn()
This returns a list of WebID and ListID
its both GUIDs which kind of stinks since we don’t memorize those. So next what you can do to get the URL is put in Get-SPSite http://sitecollectionurl | Get-SPWeb | select URL, id

December 24th, 2010
Finally, an issue that I am passionate about. I have looked for information of this caliber for the last several hours. Your site is greatly appreciated.
December 24th, 2010
Glad I can help and that you find it useful!
December 25th, 2010
It is your turn to come up with that concept that clarifies dilemmas with so well.
January 10th, 2011
This is very useful.
February 13th, 2012
Very use full. Thank you for the post.
February 14th, 2012
How do I turn this into a script? I’m not experienced with creating PS scripts, just running command lines.
Thanks.
March 8th, 2012
you can just save the file with a .ps1 extension and then you can just call the file from the command prompt.
February 21st, 2012
Yay – another classic case lack of usability from Microsoft! Bottom line – this shouldn’t be a problem in the first place!
It should be fixed at the base functionality of the error message – e.g.
“Site columns which are included in content types cannot be deleted. Remove all references to thi site column prior to deleting it. This site column is used in the following content types:
- contenttype1
- contenttype2
- contenttype3
…
“
September 10th, 2012
The above powershell gives me ListID and WebId
Is there any way of getting the column name or library name where the column is still in use ?
Please help
I am trying to delete a column but I get error which says that columns which are used in content and so the column cannot be deleted.
So I am trying to find where the column is still being used.
Please reply
Thanks
September 16th, 2012
Jiniv,
Yes that is essentially what this script is doing. The ListID tells you exactly what list the column is on. If you need the name you can then do get-splist {ID} and that will give you all of the details of the list.
Hope that helps
October 23rd, 2012
I created the powershell script:
$web = Get-SPSite http://“mysiteurl” | Get-SPWeb | select URL, id
$column = $web.Fields["NewsFooter"]
$column.ListsFieldUsedIn()
but get an error “cannot index into a null array.”
Did I enter the syntax wrong?
When I use your original script, I do get the WebID and ListID, and I was only able to find 2 of the lists by GUID. I get a list of 8 returned.
November 8th, 2012
Yes the syntax is wrong you don’t want to set the select URL, id into your $web variable. The select is simply just to list the URLs of the sites.
It sounds like you got it to work though. You mentioned that you do get a WebID and a ListID. I’m not sure I’m following the able to find 2 but returned 8
February 28th, 2013
If I run the following:
$web = Get-SPSite http://”mysiteurl”
$column = $web.Fields["Column Name"]
$column.ListsFieldUsedIn()
I get:
Cannot index into a null array.
At line:1 char:21
+ $column=$web.Fields[ <<<< "Column Name"]
+ CategoryInfo : InvalidOperation: (Column Name:String) [], R
untimeException
+ FullyQualifiedErrorId : NullArray
$web returns the URL correctly.
I've searched but can't see what's wrong. Any help greatly appreciated. Thanks
February 28th, 2013
what does $column return?
It sounds like you didn’t actually set that variable correctly. You need to put the actual column name in there which may be different than the name you see in the browser.
March 6th, 2013
$column returns nothing.
I’ve tried with ["Title"] which should return something as it’s a default standard column name.
This script has worked once! But then when I ran the exact same code again in the same window it fails with the error I mentioned above. It’s baffling me!
March 8th, 2013
If $Column is returning nothing than that is the problem. You aren’t correctly setting that variable which would cause the rest of the script to not work.
If you just do this $web.Fields[“Column Display Name”] with the column you are looking for you don’t get all the details of the column then you are not finding your column. Check the name that you put in and if it is correct then check to make sure that $web is set to the site you want to be on.