Get All Workflow Names Including Content Type Reference In SharePoint
Started using this handy method at the advice of a co-worker:
- public static List<string> GetWorkflowNames(SPList list)
- {
- List<string> workflowNames = new List<string>();
- if (list != null)
- {
- foreach (SPWorkflowAssociation workflowAssociation in list.WorkflowAssociations.Cast<SPWorkflowAssociation>().Where(workflowAssociation => !workflowNames.Contains(workflowAssociation.Name)))
- {
- workflowNames.Add(workflowAssociation.Name);
- }
- foreach (SPWorkflowAssociation workflowAssociation in
- from SPContentType type in list.ContentTypes
- from SPWorkflowAssociation workflowAssociation in type.WorkflowAssociations
- where !workflowNames.Contains(workflowAssociation.Name)
- select workflowAssociation)
- {
- workflowNames.Add(workflowAssociation.Name);
- }
- }
- return workflowNames;
- }
Articles & Research
SharePoint Security
SharePoint Development
SharePoint Architecture
Claims Authentication
Forefront For SharePoint
AIS / Dynamics GP
Team Foundation Server
Pex And Moles
ISA/TMG/IAG/UAG
DPM
Cardspace
Research Methodology
Rural ICT Development
Numerical Analysis
Multi-Level Research
Knowledge Management
Personal/Off-Topic