SharePoint Saturday – New York 2016

Last week, I was at New York speaking at SharePoint Saturday NYC. It was pretty exciting to see more than 600 user attending SharePoint Saturday NYC and also gave me chance to meet many of my speaker friends. The event was at Microsoft office in New York.


I would like to thank everyone who attended my session. I presented on creating SharePoint 2016 farm on Microsoft Azure using Azure Resource Manager (ARM).

http://lanyrd.com/2016/spsnyc/sfbzpz/
It is always amazing to speak at SharePoint Saturday New York since it is one of the biggest SharePoint community event with over 500 attendees every year.

Kudos to all the organisors, sponsors and volunteers for successful event!!!

I look forward to speaking in next year’s SharePoint Saturday NYC.

PowerShell – Querying User Profile Service Application – SharePoint Server 2013

This blog is quick way to show you how you can query your user profile service application for specific user. It is always easy to find user by using the UserName but in case where you do not have username available but the display name available e.g. someone giving you excel file to load data in SharePoint list.

In that case you can use the following script to query the user profile service application using the display name.

Here is the script.

 

Add-PSSnapin microsoft.sharepoint.powershell

$site = Get-SPSite "http://intranet.contoso.com/"

$web = $site.OpenWeb();

$context = Get-SPServiceContext $site;

$profileManager = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($context);   

$searchPattern = “USER DISPLAY NAME”;   

$searchResults = $profileManager.Search($searchPattern);

foreach($result in $searchResults)
{
    write-host $result.AccountName;
}

 

Search Results web part not showing all results

Many SharePoint projects uses Search Result Web Part to display data and provide refiners to further filter the result.

As usual to configure that you will drop the Search Result Web Part and provide the query to pull your data. When you test your query you will see that data is returned (if your query is correct) and you will see the result count i.e. number of results.

But when you view the result in real time you will see that the result count does not match. Search Result web part displayed less results than you were expecting.

This is because if search result web part thinks that there are some duplicate data in the results being displayed then it will automatically supress those results.

There are couple of fixes to this.

1) Search result web part settings

When providing the query you can click the Settings tab and select “Don’t remove duplicate option”.

2) Search Result Web Part Export and Import

You can also export your search result web part and find “TrimDuplicates”:true and change it with “TrimDuplicates”:false.

I hope you find this helpful.

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!" ;

 

SharePoint randomly not displaying JPG images

Today when working at a client site I ran into weird issue. Some of the sites that are using JPG images were not getting displayed in Internet Explorer. Instead of images it was showing the image not found icon i.e. X.

When I started debugging first thing I did was to open the page in Chrome and it worked just fine so that told me right away that the issue is related to browser support.

Quick research on this issue and I was able to figure out the issue.

So the issue was with the image itself. When you have .jpg image it could be in one of the two formats i.e. CMYK or RGB. Internet Explorer dropped CMYK support starting Internet Explorer 8.0. So when you have JPG image with CMYK format then it will not work in Internet Explorer 8.0 or higher.

To fix this simply open this image into image editor and change the format to RGB. If you do not have the image editor then simply open the Paint and save the image again as JPG and Paint will save it RGB format. After that you can upload it to SharePoint and it should work just fine.

 

I hope this helps someone with the same issue.