Wednesday, April 5, 2017

Fixed: Search Results not showing Document Titles

In this case  because the managed property ‘Title’ is mapped to crawled property ‘MetadataExtractorTitle’ by default at first priority .I have recreated the below issue my machine and I have provide the solution given below.


Go to Central Administration >Application Management> Manage service application and tried to modify the order of this crawled property and move it down.
Search Schema and search for managed property ‘Title.’ Now, inside the mappings of the managed property, you should be able to see the below attachment



Move the mapped crawled property ‘MetadataExtractorTitle’ down to the last position and save the managed property




Then reset the index,perform a full crawl against the content sources and refresh any cache associated with Site Collection.
Once the full crawl is complete, you should see the correct titles for documents in search results, as follows:



Hope It will works fine. 

Friday, March 31, 2017

How to determine the SharePoint version in PowerShell

# Add the snapin, in case it's not already installed
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

$ver = (Get-PSSnapin microsoft.sharepoint.powershell).Version.Major
If ($ver -eq "15" )
    {
        Write-Output "SharePoint 2013 is installed"
        }
    elseif ($ver -eq "14")
    {
        Write-Output "SharePoint 2010 is installed"
        }
        else
        {
            Write-Output "Could not determine version of SharePoint"
            } 

Monday, March 27, 2017

Get Details of all fields associated with SharePoint List

$site = new-object Microsoft.SharePoint.SPSite("http://<Site URL>") #Change site URL#
    $web = $site.openweb()
    $list = $web.Lists["<List Name>"] #Get Field Details for specified list
   
    Write-Host "List Name: " $list.Title  ##Print List title
    Write-Host "------------------------------------------------------"
    Write-Host "Field Name | Field Title "
    Write-Host "------------------------------------------------------"        
   
    foreach ($field in $list.Fields) #Get all views in lists
    {
        Write-Host $field.Title " | " $field.Type -ForegroundColor Green #Write out each field (column)                        
       
    }  
    Write-Host "------------------------------------------------------"
    Write-Host " "

    $web.Dispose()
    $site.Dispose()

SharePoint: How to get Field details from list using PowerShell ?

In this article, we retrieved the particular list properties in SharePoint Site.

#Declare the variable for below functions
$SiteCollectionURL="https://sharepointonline.sharepoint.com/sites/mysite"
$listName="Project list"


function GetSPFieldDetailsForList($SiteCollectionURL, $listName)
{
    $site = new-object Microsoft.SharePoint.SPSite($SiteCollectionURL) #Change site URL#
    $web = $site.openweb()
    $list = $web.Lists[$listName] #Get Field Details for specified list
   
    foreach ($view in $list.Views) #Get all views in lists
    {
        $spView = $web.GetViewFromUrl($view.Url) #Grab views URL
        Write-Host "List Name: " $list.Title  ##Print List title
        Write-Host "------------------------------------------------------"
        Write-Host "Field Name | Field Title "
        Write-Host "------------------------------------------------------"
        foreach ($spField in $spView.ViewFields) #Loop through all view URLs and get Fields (columns)
        {
            foreach ($field in $list.Fields) #Get all fields in lists
            {
                if($spField -eq $field.Title) #if field in lists equals field in views
                {
                    Write-Host $spField " | " $field.Type -ForegroundColor Green #Write out each field (column)                      
                }
            }
        }
        Write-Host "------------------------------------------------------"
        Write-Host " "
    }  
    $web.Dispose()
    $site.Dispose()
}

GetSPFieldDetailsForAllLists

function GetSPFieldDetailsForAllLists($SiteCollectionURL)
{
    $site = new-object Microsoft.SharePoint.SPSite($SiteCollectionURL) #Change site URL#
    $web = $site.openweb()
   
    foreach ($list in $web.Lists) #Get all list in web
    {
        foreach ($view in $list.Views) #Get all views in lists
        {
            $spView = $web.GetViewFromUrl($view.Url) #Grab views URL
            Write-Host "List Name: " $list.Title  ##Print List title
            Write-Host "------------------------------------------------------"
            Write-Host "Field Name | Field Title " -ForegroundColor DarkGreen
            Write-Host "------------------------------------------------------"
            foreach ($spField in $spView.ViewFields) #Loop through all view URLs and get Fields (columns)
            {
                foreach ($field in $list.Fields) #Get all fields in lists
                {
                    if($spField -eq $field.Title) #if field in lists equals field in views
                        {
                            Write-Host $spField " | " $field.Type -ForegroundColor Green #Write out each field (column)                        
                        }
                }
            }
            Write-Host "------------------------------------------------------"
            Write-Host " "
        }
    }
    $web.Dispose()
    $site.Dispose()
}