View Single Post
Old November 15th, 2018, 12:46 AM
aabhi aabhi is offline
Registered User
Points: 5, Level: 1
Points: 5, Level: 1 Points: 5, Level: 1 Points: 5, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Nov 2018
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Facing Issue while opening .OST file in C#

I’m working as a freelancer and creating different types of projects on C# language. From last few days, I’m handling a project in which I have to open .OST file in C#. For doing such things, I have written the following code:

private void CreateInboxSubFolder(Outlook.Application OutlookApp)
      Outlook.NameSpace nameSpace = OutlookApp.GetNamespace("MAPI");
      Outlook.MAPIFolder folderInbox = nameSpace.GetDefaultFolder(
      Outlook.Folders inboxFolders = folderInbox.Folders;
      Outlook.MAPIFolder subfolderInbox = null;
            subfolderInbox = inboxFolders.Add("InboxSubfolder", 
      catch (COMException exception)
            if (exception.ErrorCode == -2147352567)
                 //  Cannot create the folder.
       if (subfolderInbox != null) Marshal.ReleaseComObject(subfolderInbox);
       if (inboxFolders != null) Marshal.ReleaseComObject(inboxFolders);
       if (folderInbox != null) Marshal.ReleaseComObject(folderInbox);
       if (nameSpace != null) Marshal.ReleaseComObject(nameSpace);
After executing these code on C# programming, I get an error message ErrorCode=-2147352567. To sort out this error I have searched over p2p Wrox forum and found no thread.

So, I have searched over the Internet and found few useful resources. But I’m confused which will fix my programming error.

Please guide.