opening a pst file

  • Thread starter noemailformefromyou
  • Start date
N

noemailformefromyou

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

T OPry

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)
 

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