Platform SDK: MAPI

IMAPISupport::OpenProfileSection

The IMAPISupport::OpenProfileSection method opens a section of the current profile and returns an IProfSect pointer for further access.

Quick Info

See IMAPISupport : IUnknown.

HRESULT OpenProfileSection(
  LPMAPIUID lpUid,                
  ULONG ulFlags,                  
  LPPROFSECT FAR * lppProfileObj  
);
 

Parameters

lpUid
[in] 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.
ulFlags
[in] Bitmask of flags that controls how the profile section is opened. The following flags can be set:
MAPI_DEFERRED_ERRORS
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.
MAPI_MODIFY
Requests read/write access. By default, objects are opened with read-only access, and callers should not work on the assumption that read/write access has been granted.
lppProfileObj
[out] Pointer to a pointer to the opened profile section.

Return Values

S_OK
The profile section was successfully opened.
MAPI_E_NO_ACCESS
An attempt was made to modify a read-only profile section or to access an object for which the caller has insufficient permissions.
MAPI_E_NOT_FOUND
There is not a profile section associated with the entry identifier passed in lpEntryID.
MAPI_E_UNKNOWN_FLAGS
Reserved or unsupported flags were used, and therefore the operation did not complete.

Remarks

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.

Notes to Callers

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

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

See Also

IMAPIProp : IUnknown, IProfSect : IMAPIProp, MAPIUID