Share via


MapToIcon Element (View)

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

Returns the file name of the icon associated with a given file name extension and ProgID.

<MapToIcon>
    ProgID|File_Extension
</MapToIcon>

Attributes

Attribute

Description

None

N/A

Child Elements

Numerous

Parent Elements

Numerous

Occurrences

Minimum: 0

Maximum: Unbounded

Remarks

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

<MapToIcon>ProgID|File_Extension </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, <MapToIcon>|xls</MapToIcon> renders the Microsoft Excel .gif file defined within the ByExtension element of the DocIcon.xml file, and using <MapToIcon>Excel.Sheet|htm</MapToIcon> renders the Excel .gif file defined in the ByProgID element of DocIcon.xml, but <MapToIcon>CustomApp.Baz|htm</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 Windows SharePoint Services 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

The following example creates the linked application icon that appears on the toolbar in the Edit Properties view for a document library item. The example uses the MapToIcon element to construct the URL of the icon based on the file extension of the document and the ProgID of the application associated with the document.

<HTML><![CDATA[
   <a tabindex=2 class="ms-toolbar" target=_self href="javascript:" 
    onclick="javascript:editDocumentWithProgID2(' ]]>
</HTML>
<ScriptQuote NotAddingQuote="TRUE">
   <Field Name="ServerUrl" URLEncodeAsURL="TRUE" />
</ScriptQuote>
<HTML><![CDATA[ ',' ]]></HTML>
<GetVar Name="ProgID" />
<HTML><![CDATA[ ',' ]]></HTML>
<GetVar Name="Editor" />
<HTML><![CDATA[ ');javascript:return false;" ACCESSKEY=I 
   ID=diidEditItem> <IMG BORDER=0 ALT=" ]]>
</HTML>
<HTML>Icon</HTML>
<HTML><![CDATA[ " SRC=" ]]></HTML>
<ImagesPath />
<MapToIcon>
   <Column Name="HTML_x0020_File_x0020_Type" />
   <HTML>|</HTML>
   <Column Name="File_x0020_Type" />
</MapToIcon>
<HTML><![CDATA[ "></a>]]></HTML>