Use PowerShell to set security timeout in SharePoint

A user logged off after a certain period of time from sharepoint 2010 site. You can reset this timeout according to your requirement.  If you need a user session to be open for more time you can always change the security time out by using PowerShell. Open PowerShell management console and copy past the following code. Note: change the session Time span according to your need. In this code it is setup as 1 hour and 20 minutes. $SPSite = Get-SPSite("[URL of site collection]") $webApp = $SPSite.WebApplication $webApp.FormDigestSettings.Enabled = $true $webApp.FormDigestSettings.Expires = $true $webApp.FormDigestSettings.Timeout = New-TimeSpan -Hours 1 -Minutes 20 $webApp.Update() Now it will enable the session expiry time to 1 hour and 20 minutes for this site collection.

Creating SharePoint 2010 permission level programmatically

15. March 2011 05:03 by Rashid Aziz in Sharepoint blogs  //  Tags: , ,   //   Comments
If you have many sites under a web application, there will be a situation when you need to use the custom permission for a particular site. Some time you inherit the roles and sometime not. You can create custom permission level programmatically. You can only create new role (permission level) at site collection level, and then you can use this role in sub sites. Here is the code to create new permission level. Add assembly reference: using Microsoft.SharePoint;   //Code:      SPSite site = new SPSite(SPContext.Current.Site.Url);      SPWeb web = site.OpenWeb();     if(web.HasUniqueRoleDefinitions || web.IsRootWeb)     {         try         {             web.AllowUnsafeUpdates = true;             SPRoleDefinition roleDef = new SPRoleDefinition();             roleDef.BasePermissions = SPBasePermissions.ManageLists |             SPBasePermissions.CancelCheckout |                         SPBasePermissions.AddListItems |             SPBasePermissions.EditListItems |             SPBasePermissions.DeleteListItems;             roleDef.Name = "EblogIn Role";            web.RoleDefinitions.Add(roleDef);            web.Update();   }   catch (Exception ex) { }   }

Stay connected

SharePoint Links

Month List