Measurement Studio for .NET Languages

Showing results for 
Search instead for 
Did you mean: 

Read .ost file in C# programming

I’m new in C# programming. I’m using C# version 7.0 and .NET core framework. I want to read .ost file in C# programming. I have created a file and write the code. After writing code, an exception occurs “invalid shared folder”. I’m trying to sort out this issue from last 2 days but still can’t succeed.

Lines of Code:


Application objOutlookApplication = new Microsoft.Office.Interop.Outlook.Application();

NameSpace objNamespace = objOutlookApplication.GetNamespace("MAPI");

MAPIFolder objMAPIFolder = null;


objMAPIFolder = (

MAPIFolder)objNamespace.OpenSharedFolder(@"abcsync:\\Documents\\joseph\\Local Settings\\Application Data\\Microsoft\\Outlook\\outlook.ost", null, null, null);

Folder objFolder = (Folder)objNamespace.GetDefaultFolder(OlDefaultFolders.olFolderCalendar);

AppointmentItem objAppointmentItem = (AppointmentItem)objOutlookApplication.CreateItem(OlItemType.olAppointmentItem);



catch (System.Exception e)




I don’t understand why I’m getting this exception. I have searched this Question this site ( and I have not found any question related to my exception.

I’m so frustrated due to this exception. After searching a lot on C# programming forums, I have found few forums threads. Maybe it will helpful for me.


Which thread is helpful for my exception?

0 Kudos
Message 1 of 1