View all Crawled Properties for a given SharePoint Document

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 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

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