The IMsgServiceAdmin::SetPrimaryIdentity method designates a message service to be the supplier of the primary identity for the profile.
See IMsgServiceAdmin : IUnknown.
HRESULT SetPrimaryIdentity(
LPMAPIUID lpUID,
ULONG ulFlags
);
The IMsgServiceAdmin::SetPrimaryIdentity method establishes a message service as the supplier of the primary identity for the profile. The primary identity is typically the user logged on to the message service. It is represented by three properties:
Every service provider in the designated message service sets these three properties to the display name, entry identifier, and search key of the messaging user that is supplying the primary identity. Clients can retrieve the primary identity's entry identifier by calling IMAPISession::QueryIdentity.
Another property, PR_RESOURCE_FLAGS, is set to STATUS_PRIMARY_IDENTITY for every provider that is a member of the message service supplying the primary identity and to SERVICE_PRIMARY_IDENTITY for the message service. When a service provider cannot supply the primary identity for its message service, it sets PR_RESOURCE_FLAGS to STATUS_NO_PRIMARY_IDENTITY. SetPrimaryIdentity sets the PR_RESOURCE_FLAGS property of each message service that is not supplying the primary identity to SERVICE_NO_PRIMARY_IDENTITY.
Each message service provider that MAPI has information about can establish an identity for each of its users when a client logs on to the service. However, because MAPI supports connections to multiple service providers for each MAPI session, there is no firm definition of a particular user's identity for the MAPI session as a whole; a user's identity depends on which service is involved. Clients can call SetPrimaryIdentity to designate one of the many identities established for a user by message services as the primary identity for that user.
IMAPISession::QueryIdentity, MAPIUID