PersonalStorage.MergeWith

MergeWith(string[])

Merges one or more other PST files into this PST.

public void MergeWith(string[] sourceFileNames)
ParameterTypeDescription
sourceFileNamesString[]The paths of the PST files to merge.

Exceptions

exceptioncondition
ArgumentNullExceptionsourceFileNames is null.
ArgumentExceptionAn element of sourceFileNames is null or empty.

Remarks

StorageProcessing is raised before each source is merged, and StorageProcessed after it.

Examples

This example merges two PST files into a third one and reports each file as it is merged.

[C#]

using (var pst = PersonalStorage.FromFile("merged.pst"))
{
    pst.StorageProcessing += (sender, e) => Console.WriteLine($"Merging {e.FileName}");

    // Add the contents of the other files to merged.pst
    pst.MergeWith(new[] { "2024.pst", "2025.pst" });
}

[Visual Basic]

Using pst As PersonalStorage = PersonalStorage.FromFile("merged.pst")
    AddHandler pst.StorageProcessing, Sub(sender, e) Console.WriteLine($"Merging {e.FileName}")

    ' Add the contents of the other files to merged.pst
    pst.MergeWith(New String() {"2024.pst", "2025.pst"})
End Using

See Also


MergeWith(Stream[])

Merges one or more other PST streams into this PST.

public void MergeWith(Stream[] sourceStreams)
ParameterTypeDescription
sourceStreamsStream[]The streams with the PST data to merge.

Exceptions

exceptioncondition
ArgumentNullExceptionsourceStreams is null.
ArgumentExceptionAn element of sourceStreams is null.

Remarks

StorageProcessing is raised before each source is merged, and StorageProcessed after it.

See Also