If you have in the web part a reference to the SPListItem object, you can use 
the following code sample:
switch (this.ItemType)
               {
                   case SharePointItemType.Document:
                   case SharePointItemType.ListItem:
                       if (this.ListItem != null && this.ListItem.File != null)
                       {
                           return this.ListItem.File.IconUrl;
                       }
                       else
                           return "blank.GIF";
                       break;
                   case SharePointItemType.Folder:
                       return "FOLDER16.GIF";
                   default:
                       return "blank.GIF";
               }

But if you are using search, and don’t want to load the ListItem object and you 
don’t get the icon in the query results, then worst case scenario use the 
following example (note- I am writing in outlook – not tested in c# - debug the 
code first, but you get the idea I hope):


private const string docIconXmlPFRelativePath = @"\Common Files\Microsoft 
Shared\web server extensions\12\TEMPLATE\XML\DOCICON.XML";
public string GetIcon(string itemExtension)
        {
                if (itemExtension.Length > 0)
                {
                    try
                    {
                        string pathToFile = 
Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + 
docIconXmlPFRelativePath;
                        XmlDocument docs = new XmlDocument();
                        docs.Load(pathToFile);
                        XmlNode docNode = 
docs.DocumentElement.SelectSingleNode("//[EMAIL PROTECTED]'" + itemExtension + 
"']");
                        if (docNode != null)
                        {
                            If (docNode.Attributes["Value"] != null)
Return docNode.Attributes["Value"];
                        }
                    }
                    catch { }
                }
return "";
            }

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Shirley Priyanka
Sent: Friday, 2 May 2008 1:36 PM
To: [email protected]
Subject: RE: [OzMOSS] RE: FullTextSQL query help

I have already tried using PictureThumbnailURL and PictureURL.....They are just 
empty...

What do I do to get the values properly?

A winner is not one who never fails, but one who NEVER QUITS!


--- On Fri, 5/2/08, Aaron Saikovski <[EMAIL PROTECTED]> wrote:
From: Aaron Saikovski <[EMAIL PROTECTED]>
Subject: RE: [OzMOSS] RE: FullTextSQL query help
To: [email protected]
Date: Friday, May 2, 2008, 3:14 AM
Thanks...Will pass this on.

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Sezai KOMUR
Sent: Friday, 2 May 2008 12:47 PM
To: [email protected]
Subject: [OzMOSS] RE: FullTextSQL query help

Yes I think you may be able to get a document icon as a managed property.

Navigate to your SSP search settings to the Metadata Property Mappings  
http://sharedservices/ssp/admin/_layouts/schema.aspx

There are managed properties for –
PictureThumbnailURL
http://sharedservices/ssp/admin/_layouts/managedproperty.aspx?property=PictureThumbnailURL

PictureUrl
http://sharedservices/ssp/admin/_layouts/managedproperty.aspx?property=PictureThumbnailURL

Hopefully they return the path to the image you need. Just use them in your 
enterprise search query - "Select url, PictureUrl, PictureThumbnailURL from 
Scope()"

You may need to investigate further. Also, I suggest trying out as many Managed 
Properties in your query and look into the data returned by each, you can get 
quite a lot of data out of Enterprise Search, more than you expect.

Have fun!
Sezai Kömür
Senior Developer  - BEng, BSc - Microsoft Certified Technology Specialist  -  
http://www.moss2007.com.au/

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Aaron Saikovski
Sent: Friday, 2 May 2008 10:36 AM
To: [email protected]
Subject: [OzMOSS] FW: FullTextSQL query help

Hi All,
Can anyone offer any suggestions for Shirley?
She basically wants the icons associated with the results to appear as part of 
the search results..
If the item is a word document, she wants a word icon to appear next to it. 
That kind of thing.

(see her email below)

Cheers,
Aaron

From: Shirley Lee
Sent: Friday, 2 May 2008 10:33 AM
Subject: FullTextSQL query help

Hi All,

I have created a custom web part which executes FullTextSQL query and displays 
results in a datagrid....
I want to replicate the behaviour of SearchCore Results web part by displaying 
file-type specific icons.....

The only way I could think of  determining the file type is from the query 
"Select url from Scope()" and get the file extension from the url....Is there 
any other better way of determining the file type?

Please let me know your comments/ suggestions...

Regards,
Shirley.


------------------------------------------------------------------- OzMOSS.com 
- to unsubscribe from this list, send a message back to the list with 
'unsubscribe' as the subject.
Powered by mailenable.com
------------------------------------------------------------------- OzMOSS.com 
- to unsubscribe from this list, send a message back to the list with 
'unsubscribe' as the subject.
Powered by mailenable.com
------------------------------------------------------------------- OzMOSS.com 
- to unsubscribe from this list, send a message back to the list with 
'unsubscribe' as the subject.
Powered by mailenable.com


________________________________
Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it 
now.<http://us.rd.yahoo.com/evt=51733/*http:/mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ%20>
 ------------------------------------------------------------------- OzMOSS.com 
- to unsubscribe from this list, send a message back to the list with 
'unsubscribe' as the subject.
Powered by mailenable.com

Reply via email to