SharePoint Online - Cannot Delete Content Type


I created a content type in SharePoint online, and am now trying to delete that content type. I get the error that the content type I am trying to delete is still in use, and that I need to remove it from all lists or sites first.

So far I have tried:
  1. Deleting all documents that used this content type.
  1. Emptied the recycle bin after deleting the documents.
  1. Deleted the entire document library that used this content type.
  1. Downloaded SharePoint Online Client Browser from Github, but this doesn't show content type usage.
  1. Tried various powershell scripts, but the examples are not for SP online.
  1. Tried to use CSOM, but I cannot seem to find content type usage

Any ideas, code or scripts that can show content types usage for SPO would be much appreciated.
maaknplanSenior DeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Zaheer IqbalTechnical Assurance & ImplementationCommented:
Have you deleted it from the task list ?
Zaheer IqbalTechnical Assurance & ImplementationCommented:
Nice Technet Script. Script to find lists and libraries

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
maaknplanSenior DeveloperAuthor Commented:
Thanks for the reply. There are no task lists in any of the sites unless I am missing something. I ran a CSOM version of the Technet script you suggested, and still came up with nothing. I added the content type to a few libraries to test the code.
Acronis Data Cloud 7.8 Enhances Cyber Protection

A closer look at five essential enhancements that benefit end-users and help MSPs take their cloud data protection business further.

maaknplanSenior DeveloperAuthor Commented:
This code pointed me in the right direction to find content types.
Walter CurtisSharePoint AEDCommented:
You need to remove the content type from the document library, not just the document in the library.

Good luck...
maaknplanSenior DeveloperAuthor Commented:
It turns out the library I deleted was still lurking in the secondary recycle bin in the admin site. Once I emptied the secondary recycle bin, the content type deleted with no problem.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.