1

I try to add a task/appointment to outlook from windows service. I'm using such code to do this:

RDOSession session = new RDOSession();

session.Logon();

RDOAppointmentItem appo = (RDOAppointmentItem)session.GetDefaultFolder(rdoDefaultFolders.olFolderCalendar).Items.Add();

appo.Subject = lessons[i].Type;
appo.Start = lessons[i].Start;
appo.End = lessons[i].End;
appo.Save();
session.Logoff();

Everything works fine when another instance of outlook isn't running. But when it is I get such error:

Error in IMAPISession::OpenMsgStore: MAPI_E_FAILONEPROVIDER
ulVersion: 0
Error: Nie mo¿na otworzyæ (Can't open file) C:\Users\d3dek\AppData\Local\Microsoft\Outlook\Outlook.pst.
Component: Foldery osobiste (Personal folders)
ulLowLevelError: 0
ulContext: 268828930

My windows service is working on user 'd3dek'. Any ideas? I read that pst folders can work with multiple instances.

1 Answers1

1

If your service and Outlook are running in diffeeren security contexts, the PST provider cannot share the PST file between different processes. What version of Outlook are you using?

Dmitry Streblechenko
  • 62,942
  • 4
  • 53
  • 78