Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

When performing a FullTextSQLQuery against my SharePoint site's document library and retrieving field 'Path', I occasionally get the likes of "Forms/DispForm.aspx?ID=45" returned at the end of a record's Path field. Instead of this - I want the url of the file (deemac.pdf for example). What field do I instead to refer to?

share|improve this question

4 Answers 4

up vote 4 down vote accepted
+250

SharePoint Search will return the url to the document in Path when it thinks a file is a document (isDocument == 1), but if the file isn't a recognized file type SharePoint will treat it as a list item and return the url of the display form in Path.

You can add support for more file types by adding IFilters (see here for PDF: How to configure PDF iFilter for SharePoint Server 2010 or Search Server 2010) or just add the file type as described in How to add a file type to the content index in SharePoint 2010

You should also consider using KeywordQuery instead of FullTextSQLQuery as this isn't supported when using FAST search or in SharePoint 2013

share|improve this answer
    
Perfect, just what I Was after. –  DeeMac Oct 30 '12 at 19:45
    
Note that you may need a restart after adding file types and of course a full crawl –  Per Jakobsen Oct 30 '12 at 19:53

FileRef will give you the URL of file

FileDirRef will give you path of folder the file exists in

and FileLeafRef is the name of the file!

Hope this helps!

share|improve this answer
    
'Property doesn't exist' on all of them. –  DeeMac Oct 29 '12 at 12:22

What you are looking at IS the URL needed. Forms/DispForm.aspx?ID=45 Let's break that URL down. "Forms/" It's a form. "DispForm.aspx" That's the form used to display results; which is what the search spider used. But with out an ID entry, you won't get any form results, just the form. "?ID=45" that's the particular form results to pull up and display.

So simply put, what you got IS the URL needed to display the results. What is being shown is the result of a form submission.

share|improve this answer
    
Ultimately - where I'm going with this is that I need the filetype. .pdf, .jpeg etc. I've got the ID as you mentioned - so for now I have the work around in place of taking the id and GetItem in the documents list using that ID. But it is a work around - one that I'm not happy with for obvious reasons. Thanks a lot for your reply. +1. –  DeeMac Oct 30 '12 at 19:26

Try with FileName field as follow:

select Title, Path, Filename from scope()

Hope it helps!! :)

It it's not then I believe, u have to go through the steps Per Jakobsen has mentioned above.

share|improve this answer
    
+1 - thanks a lot for your suggestion, but when this problem occurs (i.e. path ends in dispform.aspx) - the filename is simply DispForm.aspx. Thanks again. –  DeeMac Nov 4 '12 at 12:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.