Dividindo e Unindo arquivos PST
Contents
[
Hide
]
Dividindo e Unindo arquivos PST
A API Aspose.Email fornece a capacidade de dividir um único arquivo PST em vários arquivos PST de tamanho desejado. Também pode unir vários arquivos PST em um único arquivo PST. Tanto a divisão quanto a união de operações de PST podem ser monitoradas adicionando eventos a essas operações.
Dividindo em múltiplos PSTs
O seguinte trecho de código mostra como dividir múltiplos PSTs.
This file contains hidden or 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."); | |
} | |
Unindo em um único PST
O seguinte trecho de código mostra como unir em um único PST.
This file contains hidden or 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."); | |
} | |
Unindo Pastas de outro PST
O seguinte trecho de código mostra como unir pastas de outro PST.