Last modified: July 23, 2011

Applies to: Outlook

Opens a section of the current profile and returns an IProfSect pointer for further access.

HRESULT OpenProfileSection(
ULONG ulFlags,
LPPROFSECT FAR * lppProfileObj


[in] A pointer to the MAPIUID structure that identifies the profile section to be opened. Passing NULL for the lpUid parameter opens the caller's profile section.


[in] A bitmask of flags that controls how the profile section is opened. The following flags can be set:


Allows OpenProfileSection to return successfully, possibly before the profile section is fully accessible to the caller. If the profile section is not accessible, making a subsequent object call can result in an error.


Requests read/write permission. By default, objects are opened as read-only, and callers should not work on the assumption that read/write permission has been granted.


[out] A pointer to a pointer to the opened profile section.


The profile section was successfully opened.


An attempt was made to modify a read-only profile section or to access an object for which the caller has insufficient permissions.


There is not a profile section associated with the entry identifier passed in lpEntryID.


Reserved or unsupported flags were used and, therefore, the operation did not complete.

The IMAPISupport::OpenProfileSection method is implemented for all support objects. Service providers and message services call OpenProfileSection to open a profile section and retrieve a pointer to its IProfSect interface implementation.

OpenProfileSection opens profile sections as read-only, unless you set the MAPI_MODIFY flag in the ulFlags parameter and your permission is sufficient. Setting this flag does not guarantee read/write permission; the permissions that you are granted depend on your access level and the object.

If OpenProfileSection attempts to open a nonexistent profile section as read-only, it returns MAPI_E_NOT_FOUND. If OpenProfileSection attempts to open a nonexistent profile section as read/write, it creates the profile section and returns the IProfSect pointer.