View all Crawled Properties for a given SharePoint Document View all Crawled Properties for a given SharePoint Document
Arpit Patel

Arpit Patel

March 31, 2013

All Post
View-all-Crawled
Share:

View all Crawled Properties for a SharePoint Document

I often need to examine all the properties of a document. This is most useful for researching issues relating to the crawl property values

In this little PowerShell function I grab the SPItem, and split the internal XML with line feeds. Here’s the function:

 

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, simply replace with the url of a file within a document library, here’s an example:

#Get-CrawledPropertyNames "http ://SharePoint/sites/SPWeb/Library/folder/FileName.DOC"

2 thoughts on “View all Crawled Properties for a given SharePoint Document

    1. Absolutely, list items have properties much the same as a document does. Just use the SPItem object and iterate through its properties.

      Warm regards,

      joel

Leave a Reply

Your email address will not be published. Required fields are marked *

Want to talk?

Drop us a line. We are here to answer your questions 24*7.