-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow users to specify a Smtp Addr to Open Other Mailboxes using MAPI/HTTP #3
Conversation
…or RPC, but is required for MAPI/HTTP to open another user's mailbox. You also need KB https://support.microsoft.com/en-us/kb/3114974 if using 2013
@@ -384,6 +384,7 @@ _Check_return_ HRESULT CreateStoreEntryID2( | |||
_In_ LPMDB lpMDB, // open message store | |||
string lpszMsgStoreDN, // desired message store DN | |||
string lpszMailboxDN, // desired mailbox DN or NULL | |||
wstring SmtpAddress, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use smtpAddress
@@ -404,8 +405,8 @@ _Check_return_ HRESULT CreateStoreEntryID2( | |||
|
|||
if (lpXManageStoreEx) | |||
{ | |||
DebugPrint(DBGGeneric, L"CreateStoreEntryID2: Creating EntryID. StoreDN = \"%hs\", MailboxDN = \"%hs\"\n", lpszMsgStoreDN.c_str(), lpszMailboxDN.c_str()); | |||
SPropValue sProps[3] = { 0 }; | |||
DebugPrint(DBGGeneric, L"CreateStoreEntryID2: Creating EntryID. StoreDN = \"%hs\", MailboxDN = \"%hs\", SmtpAddress = \"%hs\"\n", lpszMsgStoreDN.c_str(), lpszMailboxDN.c_str(), SmtpAddress.c_str()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
format specifier for wide strings is %ws. %hs is for ansi
@@ -415,8 +416,11 @@ _Check_return_ HRESULT CreateStoreEntryID2( | |||
sProps[2].ulPropTag = PR_FORCE_USE_ENTRYID_SERVER; | |||
sProps[2].Value.b = true; | |||
|
|||
sProps[3].ulPropTag = PR_PROFILE_USER_SMTP_EMAIL_ADDRESS_W; | |||
sProps[3].Value.lpszW = SmtpAddress.empty() == true ? nullptr : (LPWSTR)SmtpAddress.c_str(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use const_cast for the cast here. Also, I think you're safe dropping the .empty() check here since we won't even pass this bit on when we're not using it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed the == true, but I received an error when I tried to remove the .empty().
@@ -432,6 +436,7 @@ _Check_return_ HRESULT CreateStoreEntryID( | |||
_In_ LPMDB lpMDB, // open message store | |||
string lpszMsgStoreDN, // desired message store DN | |||
string lpszMailboxDN, // desired mailbox DN or NULL | |||
wstring SmtpAddress, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
smtpAddress
@@ -601,7 +609,7 @@ _Check_return_ HRESULT OpenOtherUsersMailbox( | |||
|
|||
*lppOtherUserMDB = nullptr; | |||
|
|||
DebugPrint(DBGGeneric, L"OpenOtherUsersMailbox called with lpMAPISession = %p, lpMDB = %p, Server = \"%hs\", Mailbox = \"%hs\"\n", lpMAPISession, lpMDB, szServerName.c_str(), szMailboxDN.c_str()); | |||
DebugPrint(DBGGeneric, L"OpenOtherUsersMailbox called with lpMAPISession = %p, lpMDB = %p, Server = \"%hs\", Mailbox = \"%hs\", SmtpAddress = \"%hs\"\n", lpMAPISession, lpMDB, szServerName.c_str(), szMailboxDN.c_str(), SmtpAddress.c_str()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
%ws
@@ -57,6 +57,7 @@ _Check_return_ HRESULT HrMailboxLogon( | |||
_In_ LPMDB lpMDB, // ptr to message store | |||
string lpszMsgStoreDN, // ptr to message store DN | |||
string lpszMailboxDN, // ptr to mailbox DN | |||
wstring SmtpAddress, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
smtpAddress
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no idea if I'm reviewing this right - but I left a few minor changes (%hs->%ws is the only real bug) that we should get in before merging
Let me know if you have questions