MAPIFolder.SetCustomIcon(StdPicture) Method

Definition

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

public:
 void SetCustomIcon(stdole::StdPicture ^ Picture);
public void SetCustomIcon (stdole.StdPicture Picture);
Public Sub SetCustomIcon (Picture As StdPicture)

Parameters

Picture
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:

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.

Applies to