Avoid login dialog

S

sshock

I'm trying to automate creating a PST and placing some emails in it
from VC++.

I shouldn't need to log into an Exchange server, as I'm not sending or
receiving any email. I just want to create a PST file. I'm not
calling olNs.Logon, but it's still popping up anyways.

Unfortunately, I cannot get it to avoid showing the login dialog,
unless Outlook was already running and I was already logged in, or
unless I switch Outlook to offline. If I could programatically set it
to offline, that would solve my problem.

CApplication olApp;
COleException e;
if( !olApp.CreateDispatch("Outlook.Application", &e) ) { return; }
CNameSpace olNs(olApp.GetNamespace("MAPI"));
olNs.AddStoreEx(COleVariant(CString("C:\\plhtest.pst")), 2);
... (Create MailItem objects and add to newly created store) ...

Is there any way to solve this?

Thanks,
Phillip Hellewell
 
D

Dmitry Streblechenko

If you need to add a PST store to a profile without actually logging to that
profile, you will need to use the profile API - see numerous posts on this
subject:
http://www.google.com/search?hl=en&q="mspst+ms"+configuremsgservice
<plug>ProfMan (comes with the distributable version of Redemption) will let
you do that in a dozen lines of code or less -
http://www.dimastr.com/redemption/profiles.htm#example4</plug>

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top