Dividir y Fusionar archivos PST
Contents
[
Hide
]
Dividir y Fusionar archivos PST
La API Aspose.Email proporciona la capacidad de dividir un solo archivo PST en múltiples archivos PST de tamaño deseado. También puede fusionar múltiples archivos PST en un solo archivo PST. Tanto las operaciones de división como de fusión de PSTs se pueden rastrear agregando eventos a estas operaciones.
División en múltiples PSTs
El siguiente fragmento de código muestra cómo dividir múltiples PSTs.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
For complete examples and data files, please go to https://github.com/kashifiqb/Aspose.Email-for-C | |
System::String dataDir = RunExamples::GetDataDir_Outlook(); | |
try | |
{ | |
System::String dstSplit = dataDir + L"Chunks\\"; | |
// Convert.ToString("Chunks\\"); | |
// Delete the files if already present | |
{ | |
const System::ArrayPtr<System::String>& array_ = System::IO::Directory::GetFiles(dstSplit); | |
for (int i_ = 0; i_ < array_->Count(); ++i_) | |
{ | |
System::String file__1 = array_[i_]; | |
{ | |
System::IO::File::Delete(file__1); | |
} | |
} | |
} | |
{ | |
System::SharedPtr<PersonalStorage> personalStorage = PersonalStorage::FromFile(dataDir + L"Sub.pst"); | |
// The events subscription is an optional step for the tracking process only. | |
personalStorage->StorageProcessed.connect(PstSplit_OnStorageProcessed); | |
personalStorage->ItemMoved.connect(PstSplit_OnItemMoved); | |
// Splits into pst chunks with the size of 5mb | |
personalStorage->SplitInto(5000000, dataDir + L"\\Chunks\\"); | |
} | |
} | |
catch (System::Exception& ex) | |
{ | |
System::Console::WriteLine(ex.get_Message() + L"\nThis example will only work if you apply a valid Aspose Email License. You can purchase full license or get 30 day temporary license from http:// Www.aspose.com/purchase/default.aspx."); | |
} | |
Fusión en un solo PST
El siguiente fragmento de código muestra cómo fusionar en un solo PST.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
For complete examples and data files, please go to https://github.com/kashifiqb/Aspose.Email-for-C | |
// The path to the File directory. | |
System::String dataDir = RunExamples::GetDataDir_Outlook(); | |
System::String dst = dataDir + L"Sub.pst"; | |
totalAdded = 0; | |
try | |
{ | |
{ | |
System::SharedPtr<PersonalStorage> personalStorage = PersonalStorage::FromFile(dst); | |
// The events subscription is an optional step for the tracking process only. | |
personalStorage->StorageProcessed.connect(PstMerge_OnStorageProcessed); | |
personalStorage->ItemMoved.connect(PstMerge_OnItemMoved); | |
// Merges with the pst files that are located in separate folder. | |
personalStorage->MergeWith(System::IO::Directory::GetFiles(dataDir + L"MergePST\\")); | |
System::Console::WriteLine(L"Total messages added: {0}", System::ObjectExt::Box<int32_t>(totalAdded)); | |
} | |
System::Console::WriteLine(System::Environment::get_NewLine() + L"PST merged successfully at " + dst); | |
} | |
catch (System::Exception& ex) | |
{ | |
System::Console::WriteLine(ex.get_Message() + L"\nThis example will only work if you apply a valid Aspose Email License. You can purchase full license or get 30 day temporary license from http:// Www.aspose.com/purchase/default.aspx."); | |
} | |
Fusión de Carpetas de otro PST
El siguiente fragmento de código muestra cómo fusionar carpetas de otro PST.