Hello
I try to merge a pst file with ost or merge one file with another.(Like outlook import)
I used the method (saveAS and mergeWith) but each time it does not work
Outlook 2010
Ost = Office365 Account
Thank you in advance for your help
Soufiane
Hi,
Hi,
save pst to Ost
This is OK
Using ost As PersonalStorage = PersonalStorage.FromFile(DirectoryOstFile.Text)
ost.SaveAs(dataDir & “” & Convert.ToString(NameFilePST), FileFormat.Pst)
End Using
Merge Ost with pst
Not Ok
Dim dst As String = Convert.ToString(“c:\backups”)
Using ost1 As PersonalStorage = PersonalStorage.FromFile(DirectoryOstFile2)
ost1.MergeWith(Directory.GetFiles(dst))
End Using
Error:
Thank you for yor help
soufiane
I try to merge Ost with another ost this also not working
Using ost1 As PersonalStorage = PersonalStorage.FromFile(DirectoryOstFile2)
ost1.MergeWith(Directory.GetFiles(dst))
End Using
error (sory in french)
Thank you for yor help
Hi,
Hi,
Thank you for your reply.
English translation version of the error message
Cannot display the folder. Microsoft Outlook cannot access the specified folder location. The operation failed. An object cannot be found
I don’t have a sample pst/ost, juste production file.
I’m just looking for code to merge two files ost (Mail different)
Thank you
Soufiane
Hi Soufiane,
You may please try the sample code below to merge the files. If issue is not resolved and some exception is raised, please share some sample files (as requested earlier as well) to observe the issue. Please remember that without the sample files, it is not possible to provide any assistance in this regard.
string dataDir = “”;
string dst = dataDir + “Sub.ost”;
totalAdded = 0;
try
{
using (PersonalStorage personalStorage = PersonalStorage.FromFile(dst))
{
// The events subscription is an optional step for the tracking process only.
personalStorage.StorageProcessed += PstMerge_OnStorageProcessed;
personalStorage.ItemMoved += PstMerge_OnItemMoved;
// Merges with the pst files that are located in separate folder.
personalStorage.MergeWith(Directory.GetFiles(dataDir + @“MergeOST”));
Console.WriteLine(“Total messages added: {0}”, totalAdded);
}
Console.WriteLine(Environment.NewLine + "OST merged successfully at " + dst);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
We are sorry for any inconvenience caused to you.