View Single Post
  #2 (permalink)  
Old November 20th, 2018, 01:43 AM
tonymufford@gmail.com tonymufford@gmail.com is offline
Registered User
Points: 3, Level: 1
Points: 3, Level: 1 Points: 3, Level: 1 Points: 3, 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

Quote:
Originally Posted by aabhi View Post
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:

Code:
private void CreateInboxSubFolder(Outlook.Application OutlookApp)
{
      Outlook.NameSpace nameSpace = OutlookApp.GetNamespace("MAPI");
      Outlook.MAPIFolder folderInbox = nameSpace.GetDefaultFolder(
            Outlook.OlDefaultFolders.olFolderInbox);
      Outlook.Folders inboxFolders = folderInbox.Folders;
      Outlook.MAPIFolder subfolderInbox = null;
      try
      {
            subfolderInbox = inboxFolders.Add("InboxSubfolder", 
                 Outlook.OlDefaultFolders.olFolderInbox);
      }
      catch (COMException exception)
      {
            if (exception.ErrorCode == -2147352567)
                 //  Cannot create the folder.
                 System.Windows.Forms.MessageBox.Show(exception.Message);
       }
       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.
http://p2p.wrox.com/c-c-4/

So, I have searched over the Internet and found few useful resources. But I’m confused which will fix my programming error.
https://community.hortonworks.com/qu...-language.html
https://www.nopcommerce.com/boards/t...ing-c-net.aspx
https://www.stellarinfo.com/convert-ost-to-pst.php
https://codepad.co/snippet/dyjIh4PQ

Please guide.
The error is on which line exactly?. You could try to exclude NULL values and see if that works. For reference check out :

https://stackoverflow.com/questions/...020009-subform
https://www.add-in-express.com/creat...-a-new-folder/
https://social.msdn.microsoft.com/Fo...=csharpgeneral
https://www.edbmails.com/pages/ost-t...st-to-pst.html
https://www.access-programmers.co.uk...d.php?t=293137