Get all workflows associated with all lists in Site

Here I have written a PowerShell script to find details of all workflows associated with all lists in Site Collection.

//Script Starts

Add-PSSnapin Microsoft.Sharepoint.Powershell
$url = “http://contoso.com”

$spSite = new-object Microsoft.SharePoint.SPSite($url)
foreach($web in $spSite.AllWebs)
{
foreach($list in $web.Lists)
{
foreach($wf in $list.WorkflowAssociations)
{
Write-Host “$($list.Title)” -foreground White
 Write-Host “$($wf.Name)” -foreground Green
}
}

}
$spSite.Dispose()

//Script ends

This script provides details on workflow associated with list, once we get the information about workflow, we can execute other commands as required.

————————————–

for queries, suggestions, feedback contact me on

email :bipinparshottam@gmail.com

skype: bipin.pankhania

Advertisements

Known issue with Globally Reusable Workflow SharePoint 2010

Hello, here I would like to share details about issues I faced with SharePoint Designer 2010 when tried to edit and Save globally reusable workflow.

what I did is, I had taken a copy of Approval – SharePoint 2010 workflow.

Did some changes, and published it globally.

Step to Copy and Edit Existing Globally Reusable Workflow:

Step 1: Open SharePoint Designer 2010 -> Open the site -> Click on Workflows left navigation panel.

Right Click on Approval -SharePoint 2010 from the list of available workflows.

GRW

Step 2: Fill in name and description. this will open following screen. Click on first highlighted part(Approval workflow Task).

wf

Step 3: Click on Change behavior of overall task process and make changes as per your need, click Save and Publish.

change

Now after Publishing, when I tried to edit again and Clicked on Save, it detached workflow instance from List/Library wherever it was used after first Published.

seems this is a known issue with SharePoint Designer  2010 with no solution around.

here are few references.

https://social.msdn.microsoft.com/forums/sharepoint/en-US/24776323-9c76-4d57-a76d-621640e7ae62/problems-with-updating-globally-published-and-reusable-workflows

https://www.kieferconsulting.com/blog/Pages/SP2010GlobalWorkflowErrors.aspx

————————————–

for queries, suggestions, feedback contact me on

email :bipinparshottam@gmail.com

skype: bipin.pankhania

Custom Content Query Webpart View Additional/Custom Fields

Here I would like to explain details on How to fetch additional/custom fields in Custom Content Query webpart programmatically.

We can set CommonViewFields property of Custom Content Query webpart to fetch additional/Custom column.

Following is the example of sample Custom Content Query Webpart, I assume user has basic knowledge on how to create Custom Content Query webpart class. It is a normal class which Inherits from ContentByQueryWebPart

public class CustomCQWP : ContentByQueryWebPart
{

//Variable Declaration(same approach we take generally for class)

public string srtTBD;

Public int intTBD; etc.

// Override onInit method

protected override void OnInit(EventArgs e)
{

//here we write our sample query which will override existing ContentQueryWebPart’s Query.

base.OnInit(e);
SPQuery query = new SPQuery();

QueryOverride = “<Query><Where><Eq><FieldRef Name=\”Title\” /><Value        Type=\”Text\”>test</Value></Eq></Where></Query>”;

//here we specify additional/custom field which query should bring across

// this is similar to adding one more field to viewFields in CAML Query

QueryOverride = query.Query;
this.CommonViewFields = “PublishingPageContent,Publishing HTML”;

//this.CommonViewFields syntax would be “Internal Name, DataType”

}

protected override void CreateChildControls()

{ // Your code here..

}

}

————————————–

for queries, suggestions, feedback contact me on

email :bipinparshottam@gmail.com

skype: bipin.pankhania