MOSS Content Types – Identify Content Types with WorkFlow

Page copy protected against web site content infringement by Copyscape

In some cases, it may be useful to query the existing Content Types in your site collection that have an associated Workflow defined. Use this query to loop through your content types and find the ones that have workflow enabled.

         string siteCollectionName = "http://devsite";
            SPSite siteCollection = new SPSite(siteCollectionName);
            SPWeb site = siteCollection.OpenWeb();
            foreach (SPContentType contentType in site.AvailableContentTypes)
            {
               if ((contentType.Group.ToString() != "_Hidden") && (contentType.WorkflowAssociations.Count > 0))
                Console.WriteLine("Content Type Name: " + contentType.Name.ToString() + " Content Type Group: " + contentType.Group.ToString());
               
            }
            Console.WriteLine("Press any key to continue….");
            Console.Read();

I am filtering out the hidden groups and using the WorkflowAssociations property to track the content types that have workflows associated with them.