We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Merge pst with ost File (Like outlook Import)

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,


Thank you for posting your inquiry.

Please share your sample input files with us along with more details about the exact problem you are facing. We’ll look into these for assisting you further.

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,


As requested earlier, please share your sample PST/OST files with us for further investigation at our end. We’ll look into these for assisting you further. Also, can you please share with us an English translated version of the error message you are getting?

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.