I am trying to open a private pst file via C#.NET. I can't seem to
find the right answer. I thought that the following code segment
would do it, but it doesn't seem to matter what dir path I put in,
nothing works.
Outlook.Application app = new Outlook.ApplicationClass();
Outlook.NameSpace ns =app.GetNamespace("MAPI");
ns.Logon ("c:\\test.pst", "", false, true);
Now after this I am trying to access the Tasks folder within that pst
file, so maybe this is an issue. I just don't know anymore
Outlook.MAPIFolder tskFld=ns.GetDefaultFolder
Outlook.OlDefaultFolders.olFolderTasks);
Any hints, samples or whatever would be greatly appreciated. I found
lots of people on the net asking the same question, but I've never
seen an answer.
T OPry - 03 Sep 2004 20:38 GMT
I believe the NS.Logon method expects the Profile name as the first param.
When I open PST's, I have always had to use something like the following:
Dim oOutlook As New Microsoft.Office.Interop.Outlook.Application
Dim oNameSpace As Outlook.NameSpace
Dim pst As Outlook.MAPIFolder
Dim sFolderName As String = "Aug2004-03"
Dim sPstName As String = "\\ServerName\PSTFiles\MailArchive\" & sFolderName
& ".pst"
oOutlook.Session.Logon("Archive", "pass", True, True)
oNameSpace = oOutlook.Session()
oNameSpace.AddStore(sPstName)
> I am trying to open a private pst file via C#.NET. I can't seem to
> find the right answer. I thought that the following code segment
[quoted text clipped - 14 lines]
> lots of people on the net asking the same question, but I've never
> seen an answer.