Month: April 2017

Run Workflow for All Items of List in SharePoint

Posted on Updated on

In some case we need to run workflow all items in List which is very panic work  via SharePoint GUI. We have to select list and run workflow manually for each item which is not effective if situation of more rows.

Here we have small piece of cake in PowerShell command to accomplish the task but note this will not start instantly but in maximum 5 minutes as it’s triggered through SharePoint Timer Service.

$web = Get-SPWebApplication "http://mywebapp..
# URL of the Site
$web = Get-SPWeb -Identity "http://rijsharepointsite"
$wfmanager = $web.Site.WorkFlowManager
# Name of the list
$list = $web.Lists["List Name"]
# Name of the Workflow
$assoc = $list.WorkflowAssociations.GetAssociationByName("On Item Created","en-US")
$data = $assoc.AssociationData
$items = $list.Items
foreach($item in $items)
 $workflow = $wfmanager.StartWorkFlow($item,$assoc,$data,$true)



ViewState in Web Part And Custom Page SharePoint

Posted on Updated on

I was using ViewState in custom developed SharePoint Solution to store date before saving to List because of some requirements. I found that the ViewState value was getting null after some duration which again was unable to meet my requirements. I went through some blogs and found that ViewState is cleared after some duration in SharePoint.

So I Found that 30 minutes by default and then SharePoint ViewState is cleared after.

Turns out that web application has a setting that can be controlled through PowerShell.

$web = Get-SPWebApplication "http://mywebapp..." $web.FormDigestSettings.TimeOut

This is by default 30 minutes and SharePoint Viewstate cache is cleared after

FormDigestSettings.TimeOut +1 (i.e. 31 minutes)

$web.FormDigestSettings.TimeOut = New-TimeSpan -Hours 1 -Minutes 0

Increasing this time out might have some performance implications.

Nice Article Please check this for details.

AppFabric Caching (and SharePoint): Configuration and Deployment (Part 2)


Security Trimmed Control in SharePoint 2013

Posted on Updated on

This post explain about Security Trimmed Control and how to use in SharePoint with out custom coding. We can do security trimmed from SharePoint Designer for different users based of their permission.

A user can be given a permission level like:

  1. Full Control
  2. Contribute
  3. Read

Each Permission Level can map to different permissions like:

  1. Manage Web
  2. Add List Items
  3. View Pages

Security Trimmed Control

The assembly Microsoft.SharePoint.WebControls contains a control named SPSecurityTrimmedControl that does the security trimming of the child controls inside it. Just include our control inside this control and it will be displayed or hidden based on the permission specified.


<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls"
 Assembly="Microsoft.SharePoint, Version=, Culture=neutral, 
PublicKeyToken=71e9bce111e9429c" %> 
<SharePoint:SPSecurityTrimmedControl ID="SPSecurityTrimmedControl1" runat="server" 
AuthenticationRestrictions="AuthenticatedUsersOnly" Permissions="ManageWeb" 

For Full Control Permission’s Users



<SharePoint:SPSecurityTrimmedControl ID="SPSecurityTrimmedControl1" runat="server"  
AuthenticationRestrictions="AuthenticatedUsersOnly" Permissions="ManageWeb" 

    //...... your other control ....//


For Contribute or higher Permission’s Users


<SharePoint:SPSecurityTrimmedControl ID="SPSecurityTrimmedControl1" runat="server"  
AuthenticationRestrictions="AuthenticatedUsersOnly" Permissions="AddListItems" 

    //...... your other control ....//


For Read or higher Permission’s Users


<SharePoint:SPSecurityTrimmedControl ID="SPSecurityTrimmedControl1" runat="server"  
AuthenticationRestrictions="AuthenticatedUsersOnly" Permissions="ViewPages" 

    //...... your other control ....//


All these security trimmed can be added by editing Snippet Gallery both in master page or other pages.

For further more info:
Check This