Enable ECB menu on non-default column – SharePoint Server 2013

Once in a while you will get this requirement where users want to enable ECB menu on a column which is not default column. E.g. in case of Custom list you want to display ECB menu option on say your own column and not on Title column.

One way to achieve this is by using the following PowerShell script.

One word of caution please make sure you do not enable ECB menu on person or group field type.  For some reason SharePoint does not like that. In case you ran this script on Person or Group field type then simply revert  it and you would get your field data back,.

Here is the script.

Add-PSSnapin Microsoft.SharePoint.PowerShell

$web = Get-SPWeb "http://intranet.contoso.com/";

$list = $web.Lists["LISTTITLE"];

$field = $list.Fields["COLUMN"];

$field.ListItemMenu = $true;

$field.LinkToItemAllowed = [Microsoft.SharePoint.SPField+ListItemMenuState]::Required;

$field.ListItemMenuAllowed = [Microsoft.SharePoint.SPField+ListItemMenuState]::Required;

$field.Update();

$list.Update();

PowerShell to check document library versioning setting

I had this requirement where I had to loop through all the Webs and create a report on how many document libraries do not have versioning enabled.

I found this blog post which actually does something similar but it checks the version size.

http://www.sharepointdiary.com/2013/01/document-versions-size-report-powershell.html

I have updated the script for my requirements and I am sharing with you guys in case if someone had the same requirements.

Add-PSSnapin Microsoft.SharePoint.PowerShell

#Replace the URL with your Web Application

 $WebAppURL = "http://intranet.contoso.com";

 #Get the Web Application

    $WebApp=Get-SPWebApplication($WebAppURL);

    #Write the CSV Header - Tab Separated

 "Site Name`t Site URL `t Library `t Versioning Enabled" | out-file C:\temp\DocLibVersioningReport.csv ;

 #Loop through each site collection

  foreach($Site in $WebApp.Sites)

   {

    #Loop through each site in the site collection

     foreach($Web in $Site.AllWebs)

        {

            #write-host $Web.Title;

            #Loop through  each List

            foreach ($List in $Web.Lists)

            {

                #Get only Document Libraries & Exclude Hidden System libraries

                if ( ($List.BaseType -eq "DocumentLibrary") -and ($List.Hidden -eq $false) )

                {   

                     "$($Web.Title) `t $($Web.Url) `t $($List.Title) `t $($List.EnableVersioning)" | Out-File C:\temp\DocLibVersioningReport.csv -Append ;                    

                }

            }

       $Web.Dispose() ;        

        }

 $Site.Dispose() ;        

    } 

    write-host "Report Generated Successfully!" ;