IMAPISession::OpenProfileSection

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

Quick Info

See IMAPISession : IUnknown.

HRESULT OpenProfileSection(
  LPMAPIUID lpUID,              
  LPCIID lpInterface,           
  ULONG ulFlags,                
  LPPROFSECT FAR * lppProfSect  
);
 

Parameters

lpUID
[in] Pointer to the MAPIUID structure identifying the profile section.
lpInterface
[in] Pointer to the interface identifier (IID) representing the interface to be used to access the profile section. Passing NULL results in a pointer to its standard interface being returned in the lppProfSect parameter. The standard interface for a profile section is IProfSect.
ulFlags
[in] Bitmask of flags that controls access to the profile section. The following flags can be set:
MAPI_DEFERRED_ERRORS
Allows OpenProfileSection to return successfully, possibly before the profile section is fully accessible to the calling client. If the profile section is not accessible, making a subsequent call to it can result in an error.
MAPI_MODIFY
Requests read/write access. By default, profile sections are opened with read-only access, and clients should not work on the assumption that read/write access has been granted.
lppProfSect
[out] Pointer to a pointer to the profile section.

Return Values

S_OK
The profile section was successfully opened.
MAPI_E_NO_ACCESS
An attempt was made to access a profile section for which the caller has insufficient permissions.
MAPI_E_NOT_FOUND
The requested profile section does not exist.

Remarks

The IMAPISession::OpenProfileSection method opens a profile section — or object that supports the IProfSect interface. Profile sections are used for reading information from and writing information to the session profile.

OpenProfileSection cannot be used to open profile sections owned by individual service providers.

Notes to Callers

Multiple clients can open a profile section with read-only access, but only one client can open a profile section with read/write access. If another client has a profile section open that you attempt to open by calling OpenProfileSection with the MAPI_MODIFY flag set, the call will fail, returning MAPI_E_NO_ACCESS.

A read-only open operation fails if the section is open for writing.

You can create a profile section by calling OpenProfileSection with the MAPI_MODIFY flag and a non-existent MAPIUID structure in the lpUID parameter. Make sure you specify MAPI_MODIFY. If you set lpUID to point to a nonexistent MAPIUID and OpenProfileSection is set to use the default access mode of read-only, the call fails with MAPI_E_NOT_FOUND.

See Also

IMAPIProp : IUnknown, IProfSect : IMAPIProp, MAPIUID