Exchange mails (sending + receiving) on not-logged-on account, VC++ 6.0

I need to log on to an Exchange server to check my Inbox, copy the content of the mails to a text file and move the mails into an archive folder. Also I must be able to send mails.

Big Problem: The exchange mail account belongs to another windows user account.

I am Administrator, have full rights and would (if needed) hardcode all login / password stuff for the mail account ("tsdp"). But I haven't managed yet, I guess i must first impersonate myself before I can operate. Or ? I have no exchange password, only the windows user account password, but did never manage to come into the mail account.

Do I have to add an additional mail profile in order that it works ?

I use Visual C++ 6.0 / Visual Basic 6.0, what technique would allow me the most technically-up-to-date stuff and flexibility ? (no, I mean  not ".NET" and not web service stuff like ADO)  CDO 1.2.1 ? Or some MAPI functions ? I need some code snippets that help me perform this task.
LVL 1
PC-AlexAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jkrCommented:
You should be able to specify any arbitrary Exchange user name when calling 'MAPILogon()' or 'MAPILogonEx()' independent from the Windows account you're using. See also the samples at http://www.codeproject.com/internet/#MAPI and http://www.codeproject.com/internet/xymailclient.asp ("Sending and receiving e-mails from your program") in particular.
PC-AlexAuthor Commented:
Thanks for the tips, jkr, codeproject was also my first source to examine.

I just found out that the problem was due to missing rights on the exchange account: I am member of the Admin group, I am entitled to "send as" on this account, I had an additional mail profile for this box ... but that was not enough.

I had to make the check box in Active Directory Users und Computers, "View" / "Advanced Features", to be able to see "Exchange Advanced", where I can give me the "Permissions for tsdp". That was it.

I have documented the full details on http://www.a-m-i.de/tips/automation/mailautomation.php (in german)
GranModCommented:
PAQed with points refunded (500)

GranMod
Community Support Moderator

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C++

From novice to tech pro — start learning today.