Problems with Outlook object library in VB.NET

J

James Miller

Man this has been giving me headaches for two days. Please ask for more
detail and I'll provide.

I want to copy a public folder to a PST file. I'm making a VB.Net app as a
test for an eventual service to do this and other things The app use two
tree views to allow selection of the source folders for backup and the
target rootfolder.

If I use Outlook 2k3 with VS tools installed(I'm using VS2003), I added my
reference for outlook.dll but wasn't prompted for a profile when I do my
Namespace.Logon call. But I can copy the folder(a contacts list) to the
PST. My problem with that is no matter what I add the the Logon call for
the Profile name, it just uses the Defaultprofile value in HKCU...Windows
Messaging Subsystem\Profiles


If I use CDO 1.21. I get prompted for the profile at Logon but when trying
to copy the folder, I get a Type Mismatch exception from COM.

I've found code showing a way to update the CDO Container class field to a
"IPF.Contacts" folder type which I would imagine works just fine but the
fact the outlook.dll gives much greater access to objects makes it preferred
in this case.

Now one thing I did try. I deleted DefaultProfile from HKCU and ran the
prog with a string of a installed profile and I did get that profile however
with the ShowDialog set to True, I still didn't get a dialog.

I don't mind searching the registry and letting the user pick a profile from
a drop down in the app but can anyone report the same things happening with
outlook.dll from Office 2003?

TIA, James
 
J

James Miller

Update: If I call Quit on my outlook Application object and then use Logon
with a profile name I will get the profile given. Still no dialog though.
 
S

Sue Mosher [MVP-Outlook]

Service? Outlook simply isn't suitable to automate from a service. CDO 1.21 would be more appropriate, although it's not officially supported in .NET. Note that it uses different objects, which might explain the Type Mismatch errors.

You didn't show the Logon statement you're using.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 

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