PST/OST file integration with C# Issue
Posted on: 08 Oct 2014
I am using Microsoft.Office.Interop.Outlook Version 12.0.0.0 to read my outlook pst file but when compiler reaches this code outlookNs.AddStore(pstFilePath); it gives exception that “The Outlook data file (.pst) failed to load for this session.” i have triedoutlookNs.AddStoreEx(pstFilePath); also but the error was same ….any sugession ??
NOT ABLE TO READ PST/OST FILE THROUGH C#
Here I pass PST File Path & Name
IEnumerable mailItems = readPst(strSource[0].ToString(), strSource[1].ToString());
Here is the Method
private static IEnumerable readPst(string pstFilePath, string pstName)
{
List mailItems = new List();
try
{
Microsoft.Office.Interop.Outlook.Application app = new Microsoft.Office.Interop.Outlook.Application();
NameSpace outlookNs = app.GetNamespace("MAPI");
// Add PST file (Outlook Data File) to Default Profile
outlookNs.AddStore(pstFilePath);
MAPIFolder rootFolder = outlookNs.Stores[pstName].GetRootFolder();
// Traverse through all folders in the PST file
// TODO: This is not recursive, refactor
Folders subFolders = rootFolder.Folders;
foreach (Folder folder in subFolders)
{
if (folder.Name == "Inbox")
{
Items items = folder.Items;
foreach (object item in items)
{
if (item is MailItem)
{
MailItem mailItem = item as MailItem;
mailItems.Add(mailItem);
}
}
}
}
// Remove PST file from Default Profile
//outlookNs.RemoveStore(rootFolder);
progressMaxVal =(int) mailItems.Count;
}
catch (System.Exception ex)
{
}
return mailItems;
}
Posted on: 08 Oct 2014
I am using Microsoft.Office.Interop.Outlook Version 12.0.0.0 to read my outlook pst file but when compiler reaches this code outlookNs.AddStore(pstFilePath); it gives exception that “The Outlook data file (.pst) failed to load for this session.” i have triedoutlookNs.AddStoreEx(pstFilePath); also but the error was same ….any sugession ??
NOT ABLE TO READ PST/OST FILE THROUGH C#
Here I pass PST File Path & Name
IEnumerable
Here is the Method
private static IEnumerable
{
List
try
{
Microsoft.Office.Interop.Outlook.Application app = new Microsoft.Office.Interop.Outlook.Application();
NameSpace outlookNs = app.GetNamespace("MAPI");
// Add PST file (Outlook Data File) to Default Profile
outlookNs.AddStore(pstFilePath);
MAPIFolder rootFolder = outlookNs.Stores[pstName].GetRootFolder();
// Traverse through all folders in the PST file
// TODO: This is not recursive, refactor
Folders subFolders = rootFolder.Folders;
foreach (Folder folder in subFolders)
{
if (folder.Name == "Inbox")
{
Items items = folder.Items;
foreach (object item in items)
{
if (item is MailItem)
{
MailItem mailItem = item as MailItem;
mailItems.Add(mailItem);
}
}
}
}
// Remove PST file from Default Profile
//outlookNs.RemoveStore(rootFolder);
progressMaxVal =(int) mailItems.Count;
}
catch (System.Exception ex)
{
}
return mailItems;
}

Munesh SharmaRank #174 · 13.9K reputationPosted Oct 13, 2014, 1:49 AM EDT
http://www.experts-exchange.com/Programming/Languages/C_Sharp/Q_28060474.html
Eugene Owens4 reputationPosted Feb 10, 2015, 7:54 PM EST
glennt daniel2 reputationPosted Feb 13, 2015, 12:01 AM EST
For any information visit here :- http://www.recoverydeletedfiles.com/ost-to-pst-converter.html
aaronm vaughn2 reputationPosted Feb 27, 2015, 11:35 PM EST
RS Prajapati
I think that if you are opting for a manual method then it might take a long time in getting the things done perfectly. For easy and quick repair and recovery of the corrupt OST files I can suggest you a : http://www.pcrecoveryutility.com/ost-recovery-tool.html
Larry Craig6 reputationPosted Mar 24, 2015, 10:18 PM EDT
Simon Cortez2 reputationPosted Apr 15, 2015, 4:08 AM EDT
Download from here:- http://www.osttopsttool.com
James Britton2 reputationPosted Apr 24, 2015, 10:42 PM EDT
For more information, you can visit: www.sysinfotools.com/ost-file-viewer.html
Thanks.
Ronny Smith2 reputationPosted May 7, 2015, 11:14 PM EDT
Thanks for sharing such informative utility. Though, In my scenario while needed to convert from Outlook OST files to PST format , I tried Kernel for OST to PST Tool utility that worked fine in my circumstance. I would definitely recommend this OST to PST Convert application to those who are looking for such OST to PST converter solution. For more information visit: http://www.convertosttopstfree.org
or
http://www.osttopst.org
Shack Catty2 reputationPosted May 15, 2015, 4:52 AM EDT
https://ostrecoveryfreeware.codeplex.com/
Amelie Moore16 reputationPosted May 27, 2015, 4:51 AM EDT
I suggest Free OST File Viewer software to read .OST files in software panel. The tool deals to fix corrupted OST files and preview these files with components.
christa shaws2 reputationPosted Aug 10, 2015, 3:48 AM EDT
Download now: http://www.filesrecoverytools.com/ost-to-pst-converter.html
jany mariya2 reputationPosted Aug 19, 2015, 10:56 PM EDT
Kenny Cureton8 reputationPosted Aug 25, 2015, 3:07 AM EDT
Edwardoo Edwardoo10 reputationPosted Apr 1, 2016, 12:10 PM EDT
Blake Griffin2 reputationPosted Jul 24, 2016, 9:21 PM EDT
There are multiple options available for converting OST to PST file format, You can google your issue and find best solution. Last time I found a tool for doing same job and found desired result. You can also use that tool for converting ost to pst file format. Download full from here pasting