MapToIcon Element

The MapToIcon element returns an icon for the specified file name extension and ProgID.

Syntax

<MapToIcon>
</MapToIcon>
Parent Elements Child Elements
Case, DisplayPattern Column, GetFileExtension, GetProgID, HTML

Remarks

The MapToIcon element uses the following syntax, separating the ProgID from the file name extension with a pipe symbol ("|"):

<ows:MapToIcon>ProgID|FileExtension</ows:MapToIcon>

This element can be used in any rendering scenario (for example in a view, or as stand-alone element in a document), but it is most useful in a view of a document library.

For example, <ows:MapToIcon>|xls</ows:MapToIcon> would render the Microsoft Excel .gif file defined in the ByExtension section of DOCICON.XML, <ows:MapToIcon>Excel.Sheet|htm</ows:MapToIcon> would render the Excel .gif file defined in the ByProgID section of DOCICON.XML, but <ows:MapToIcon>CustomApp.Baz|htm</ows:MapToIcon> would render the generic HTML icon because the ProgID, "CustomApp.Baz," is unknown.

Note that the set of file name extensions and ProgIDs that are supported are extensible by the system administrator. They can be edited in DOCICON.XML and then the image files can be included in the Templates/1033 directory. After such a modification, Microsoft Internet Information Services (IIS) needs to be restarted. Subsequently, any new Web sites based on SharePoint Team Services from Microsoft will support the new file types and display the correct icons. The number of icons and ProgIDs that can be supported is limited only by system resources (memory and disk space).

Example

This example combines two columns in the document library to generate the correct image for the document.

<MapToIcon>
  <Column Name="HTML_x0020_File_x0020_Type"/>
  <HTML>|</HTML>
  <Column Name="File_x0020_Type"/>
</MapToIcon>