The SelectGMailAccount starts a GMail OAuth authentication process to select the GMail account for sending OAuth email
[ in, string ] LPCWSTR p_pwsActionId,
[ in ] LONG p_nAccountType
[in] Action id
[in] oauth gmail type constant, can be OAUTH_GMAIL_SAME_ACCOUNT or OAUTH_GMAIL_REUSE_ACCOUNT
S_OK on success or COM error code
NV_UNKNOWN_PROFILE - no profile loaded
NV_INVALID_ACTION - wrong action id
NV_INVALID_OPTION - wrong oauth gmail type constant for p_nAccountType
NV_ERROR_GMAIL - GMail authentication failed
This function will select the GMail account for current loaded profile and provided action id. The account will be saved for the profile only when calling SaveProfile
GMail OAuth authentication starts the default Internet browser where you can enter the GMail account and authenticate.
There are three modes that can be used with GMail OAuth email type:
- OAUTH_GMAIL_SAME_ACCOUNT: all emails will be sent with the same account, for all users that use this profile. The credentials are saved with the profile and reused for emails. The GMail account can be selected from Profile Manger or calling SelectGMailAccount. Credentials are not asked when the email is sent.
- OAUTH_GMAIL_ASK_ACCOUNT: GMail credentials are not saved with the profile. Each time an email is sent the user will be asked to select the GMail account and authenticate.
- OAUTH_GMAIL_REUSE_ACCOUNT: GMail credentials are saved with the profile, but they are different for each user that uses the profile. User will be asked to select account and authenticate when the first email is sent then the credentials are reused for the same user. The Gmail Account can also be selected or changed from the Save As dialog - Recipients dialog or calling SelectGMailAccount.
Take care that if you wish to reuse GMail account credentials with one of the OAUTH_GMAIL_SAME_ACCOUNT or OAUTH_GMAIL_REUSE_ACCOUNT options you also have to reuse profiles and do not create a new profile for each printed document.