G
Guest
I am trying to automate testing (at least partially) of an Outlook Add-In.
The trick is that I am trying to run Outlook under a different user account
(to access the test mailbox on our Exchange server). Here is what I'm doing
(this is all in C):
Host Process:
1. LogonUser()
2. Modify DACL of default Window Station and Desktop (required for child
process to display UI)
3. LoadUserProfile() to get appropriate HKCU
4. CreateProcessAsUser()
Child Process:
1. CoInitialize()
2. Outlook::_ApplicationPtr::CreateInstance()
3. send messages, traverse folders, etc
If I am running Outlook under my account when the child process launches, it
fails at step 2 fails with 0x80080005 ("server execution failed"). If I am
NOT running Outlook, the child process launches Outlook under the test
account and everything works fine. So it appears that there is a problem
with running multiple instances of Outlook on the same computer under
different user accounts. Is there a workaround? Am I doing something wrong?
Or is this just not supported?
Another problem is that the test account's Outlook profile will have to be
created the first time it is run, but I could probably figure out how to
automate that.
People could just close their instance of Outlook before running the tests,
but that's not a very good solution. Another possibility is to allow my
account/group access to the other account's mailbox, but that would be too
easy. Any ideas?
The trick is that I am trying to run Outlook under a different user account
(to access the test mailbox on our Exchange server). Here is what I'm doing
(this is all in C):
Host Process:
1. LogonUser()
2. Modify DACL of default Window Station and Desktop (required for child
process to display UI)
3. LoadUserProfile() to get appropriate HKCU
4. CreateProcessAsUser()
Child Process:
1. CoInitialize()
2. Outlook::_ApplicationPtr::CreateInstance()
3. send messages, traverse folders, etc
If I am running Outlook under my account when the child process launches, it
fails at step 2 fails with 0x80080005 ("server execution failed"). If I am
NOT running Outlook, the child process launches Outlook under the test
account and everything works fine. So it appears that there is a problem
with running multiple instances of Outlook on the same computer under
different user accounts. Is there a workaround? Am I doing something wrong?
Or is this just not supported?
Another problem is that the test account's Outlook profile will have to be
created the first time it is run, but I could probably figure out how to
automate that.
People could just close their instance of Outlook before running the tests,
but that's not a very good solution. Another possibility is to allow my
account/group access to the other account's mailbox, but that would be too
easy. Any ideas?