SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The following code just gives me the URL of the site collection. However I need to be able to determine which list is using this content type. Do I need iterate through splistitemcollection?

$site = Get-SPSite("http://portal.brisk.tea/sites/GreenTea");
foreach ($web in $site.AllWebs) 
  $ctype = $web.ContentTypes["NewTeaSample"]
  $usages = [Microsoft.Sharepoint.SPContentTypeUsage]::GetUsages($ctype)    
  foreach ($usage in $usages)
       Write-Host $usage.Url
share|improve this question
I added $ctuse.IsUrlToList method and it returns false. Does this mean the content type in question is not hooked any list for the given site collection? – Rosie O'Donnell Nov 15 '11 at 19:21
I am trying to delete a content type and it's telling me it's been in use but the scripts tell me otherwise. – Rosie O'Donnell Nov 15 '11 at 19:28
how many results do you get? – Ashish Patel Nov 15 '11 at 20:32
up vote 1 down vote accepted
  1. Make sure there aren't any sub content type that is using or inheriting from this content type. if yes, delete the child CT that inherits from this and then delete the CT in question.

-- if above does not help then you may want to try these steps ---

  1. Clean your recycle bin as there may be list or library RB that is/r using this content type.
  2. Then try to delete the CT.
share|improve this answer
Perfect. You step 1 helped like magic. There was a child CT that was inheriting from this CT. I delete the child CT, then Parent CT became delete friendly. Thanks Mary. – Rosie O'Donnell Nov 15 '11 at 21:35

If the content type was used in a list, the $usage.Url will be same as SPList's RootFolder.ServerRelativeUrl and $usage.IsUrlToList will be true. Hope this helps you.

share|improve this answer
But CT is not in use in any library but code returns the url /sites/GreenTea and Isurltolist is false. I am trying to delete the CT and getting ct in use error. – Rosie O'Donnell Nov 15 '11 at 19:40
This makes sense because /sites/GreenTea appears to be a site (root web) and not a list. – Ashish Patel Nov 15 '11 at 19:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.