Partager via


MAPIFolder.SetCustomIcon Method

Sets a custom icon that is specified by Picture for the folder.

Namespace:  Microsoft.Office.Interop.Outlook
Assembly:  Microsoft.Office.Interop.Outlook (in Microsoft.Office.Interop.Outlook.dll)

Syntax

'Declaration
<DispIdAttribute()> _
Sub SetCustomIcon ( _
    Picture As StdPicture _
)
'Usage
Dim instance As MAPIFolder
Dim Picture As StdPicture

instance.SetCustomIcon(Picture)
[DispIdAttribute()]
void SetCustomIcon(
    StdPicture Picture
)

Parameters

  • Picture
    Type: StdPicture

    Specifies the custom icon for the folder.

Remarks

The StdPicture object specified by Picture must have its Type property equal to PICTYPE_ICON or PICTYPE_BITMAP. The icon or bitmap resource can have a maximum size of 32x32. Icons that are 16x16 or 24x24 are also supported, and Microsoft Outlook can scale up a 16x16 icon if Outlook is running in high Dots Per Inch (DPI) mode. Icons of other sizes cause SetCustomIcon to return an error.

You can set a custom icon for a search folder and for all folders that do not represent a default or a special folder. If you attempt to set a custom icon for a folder that belongs to one of the following groups of folders, SetCustomIcon will return an error:

  • Default folders (as listed by the OlDefaultFolders enumeration)

  • Special folders (as listed by the OlSpecialFolders enumeration)

  • Exchange public folders

  • Root folder of any Exchange mailbox

  • Hidden folders

You can only call GetCustomIcon from code that runs in-process as Outlook. An StdPicture object cannot be marshaled across process boundaries. If you attempt to call GetCustomIcon from out-of-process code, an exception occurs. For more information, see An automation server cannot pass a pointer to the picture object's IPictureDisp implementation across process boundaries.

The custom folder icon that this method provides does not persist beyond the running Outlook session. Add-ins therefore must set the custom folder icon every time that Outlook boots.

The custom folder icon does not appear in other Exchange clients such as Outlook Web Access, nor does it appear in Outlook running on a Windows Mobile device.

See Also

Reference

MAPIFolder Interface

MAPIFolder Members

Microsoft.Office.Interop.Outlook Namespace