Skip to content
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

Merged
merged 6 commits into from
Nov 21, 2016

Conversation

drvespa
Copy link

@drvespa drvespa commented Nov 18, 2016

Let me know if you have questions

@@ -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,
Copy link
Member

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());
Copy link
Member

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();
Copy link
Member

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

Copy link
Author

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,
Copy link
Member

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());
Copy link
Member

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,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

smtpAddress

Copy link
Member

@stephenegriffin stephenegriffin left a 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

@stephenegriffin stephenegriffin merged commit 4df63bd into microsoft:master Nov 21, 2016
@drvespa drvespa deleted the OtherMbxMoH branch December 1, 2016 18:51
stephenegriffin pushed a commit that referenced this pull request Jun 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants