Tuesday 25 October 2016


Using Script
http://blog.qumsieh.ca/2010/02/16/hide-columns-in-sharepoint-new-edit-and-disp-forms/

Using Designer 
http://promx.net/en/2016/09/how-to-hide-columns-from-sharepoint-forms/ -


Using Power Shell
First load SharePoint Core Assembly
[System.Reflection.Assembly]::LoadWithPartialName(Microsoft.SharePoint)
 
$url = "http://ulabtechnologies.sharepoint.com";
$list = "Employee";
$fieldname = "NewColumn";
 
#Setting up context
$contextSite = New-Object Microsoft.SharePoint.SPSite($url);
$contextWeb = $contextSite.OpenWeb();
 
$list = $contextWeb.Lists.TryGetList($list);
$field = $list.Fields[$fieldname];
 
# Controls Field in Edit Form
$field.ShowInEditForm = 1;
# Controls Field in New Form
$field.ShowInNewForm = 0;
# Controls Field in New Form
$field.ShowInDisplayForm = 1;
# Hides fields from list settings
$field.ShowInListSettings = 1;
# Hides fields from version history
$field.ShowInVersionHistory = 1;
# Hides fields form selection in views
$field.ShowInViewForms = 1;
# Don't forget to update this field
$field.Update();
# And finally dispose everything.
$contextWeb.Dispose();
$contextSite.Dispose();

Wednesday 12 October 2016

Set Privileges for Using PowerShell to Manage SharePoint

To execute a command in the SharePoint 2013 Management Shell, open the Management Shell on a SharePoint 2010 server. To execute commands, the user must have the necessary privileges to the SharePoint object model and to the SharePoint databases. When you are working with SharePoint objects, connections to the database are generally created with the permissions of the current user. 

You can use SPShellAdmin for configuring a user’s privileges and security. Here’s how. 

To list Shell administrators:
Get-SPShellAdmin 

To add a user as a Shell administrator:
Add-SPShellAdmin -UserName -Database  

For example, to allow user Jeff Hay to execute commands against the PartnerNet site, use the following command: 
Add-SPShellAdmin -UserName Contoso\Jeff Hay 
-Database (Get-SPContentDatabase -Identity PartnerNet_ContentDatabase) 

Note that the Get-SPContentDatabase cmdlet and the PartnerNet content database name are used to retrieve the SPContentDatabase object. 

To remove a user from Shell Admin:
Remove-SPShellAdmin -UserName -Database