Compartilhar via


IMAPISession::OpenProfileSection

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

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

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

Parameters

  • lpUID
    [in] A pointer to the MAPIUID structure that identifies the profile section.

  • lpInterface
    [in] A pointer to the interface identifier (IID) that represents the interface to be used to access the profile section. Passing NULL causes the lppProfSect parameter to return a pointer to the profile section’s standard interface, IProfSect.

  • ulFlags
    [in] A 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 available to the calling client. If the profile section is not available, making a subsequent call to it can cause an error.

    • MAPI_FORCE_ACCESS
      Allows access to a profile section that does not belong to the provider.

    • MAPI_MODIFY
      Requests read/write permission. By default, profile sections are opened with read-only permission, and clients should not work on the assumption that read/write permission has been granted.

  • lppProfSect
    [out] A pointer to a pointer to the profile section.

Return Value

  • 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.

You cannot use OpenProfileSection to open profile sections that individual service providers own unless you specify MAPI_FORCE_ACCESS in the ulFlags parameter.

Notes to Callers

Multiple clients can open a profile section with read-only permission, but only one client can open a profile section with read/write permission. 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 nonexistent MAPIUID structure in the lpUID parameter. Be sure that 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 will fail with MAPI_E_NOT_FOUND.

See Also

Reference

IMAPIProp : IUnknown

IProfSect : IMAPIProp

MAPIUID

IMAPISession : IUnknown