Wednesday, December 4, 2013

Get crawled property name for your column

 

I was desperately trying to find what is the crawled property name of my column scheduling end date. 

I stumbled across this helpful powershell

Function Get-CrawledPropertyNames([string]$DocURL){ 
$DocURL = $DocURL.Replace("%20"," ")
$webfound = $false
$weburl = $DocURL
while ($webfound -eq $false) {
    if ($weburl.Contains("/")){
    $weburl = $weburl.Substring(0,$weburl.LastIndexOf("/"))
    $web = get-spweb -identity $weburl -ea 0
    if ($web -ne $null){
        $webfound = $true
    }
    }else{
    Write-Host -ForegroundColor Red "The Web could not be found"
    return -1
    }
}
$web.GetFile($DocURL).item.xml.Replace("' ", "' `n").Replace("`" ", "`" `n")

#To use enter the url of a file within a doucment library  Get-CrawledPropertyNames http://sites/doc/file.pdf

Got it from this link.

http://gallery.technet.microsoft.com/scriptcenter/Get-Crawled-Property-names-9e8fc5e0