4

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?

5
+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

2
  • Perfect, just what I Was after. Oct 30 '12 at 19:45
  • Note that you may need a restart after adding file types and of course a full crawl Oct 30 '12 at 19:53
3

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.

1
  • +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. Nov 4 '12 at 12:38
2

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!

1
  • 'Property doesn't exist' on all of them. Oct 29 '12 at 12:22
2

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.

1
  • 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. Oct 30 '12 at 19:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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