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;
}
Blake GriffinPosted Jul 25, 2016, 1:21 AM
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
Edwardoo EdwardooPosted Apr 1, 2016, 4:10 PM
Kenny CuretonPosted Aug 25, 2015, 7:07 AM
jany mariyaPosted Aug 20, 2015, 2:56 AM
christa shawsPosted Aug 10, 2015, 7:48 AM
Download now: http://www.filesrecoverytools.com/ost-to-pst-converter.html
Amelie MoorePosted May 27, 2015, 8:51 AM
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.
Shack CattyPosted May 15, 2015, 8:52 AM
https://ostrecoveryfreeware.codeplex.com/
Ronny SmithPosted May 8, 2015, 3:14 AM
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
James BrittonPosted Apr 25, 2015, 2:42 AM
For more information, you can visit: www.sysinfotools.com/ost-file-viewer.html
Thanks.
Simon CortezPosted Apr 15, 2015, 8:08 AM
Download from here:- http://www.osttopsttool.com
Larry CraigPosted Mar 25, 2015, 2:18 AM
aaronm vaughnPosted Feb 28, 2015, 4:35 AM
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
glennt danielPosted Feb 13, 2015, 5:01 AM
For any information visit here :- http://www.recoverydeletedfiles.com/ost-to-pst-converter.html
Eugene OwensPosted Feb 11, 2015, 12:54 AM
Munesh SharmaPosted Oct 13, 2014, 5:49 AM
http://www.experts-exchange.com/Programming/Languages/C_Sharp/Q_28060474.html