MboxToPst new feature

Hello
Congrats on the 23.6 and this new overload:

Anyway MailStorageConverter.MboxToPst if used with MboxStorageReader and PersonalStorage.Create will report back the live item being processed count to show a ProgressBar and to cancel in the middle of process?

Seems MailStorageConverter.MailHandler is related, do you have any sample code to use MailHandler?

Thanks, and kindly respond after the weekend :slight_smile:

Hi @australian.dev.nerds

This feature has not yet been implemented, but we will consider the possibility.

We will do it soon.

1 Like

Sorry I didn’t get your point, does it mean you’ll share MailHandler usage sample? Or will be added to the SDK in the future? :slight_smile:

@australian.dev.nerds,

Sorry for delayed response, I share an example of using MailHandler.
MailHandler is a delegate that can be used to control the conversion process.

int counter = 0;
PersonalStorage storage = MailStorageConverter.MboxToPst("source.mbox",
    "target.pst",
    delegate (MailMessage message)
    {
        counter += 1;
    });

Thank you.

1 Like

Thanks, but is this correct?

Dim counter = 0
Dim storage As PersonalStorage = MailStorageConverter.MboxToPst("source.mbox", "target.pst", Sub(ByVal message As MailMessage) counter += 1)

@australian.dev.nerds,

I guess so, but I don’t know VB that well. Sorry.

1 Like

yeah, that was correct, but syntax not supported in vs.net 2010, anyway:

MailStorageConverter.MboxToPst | Aspose.Email for .NET API Reference

MboxToPst(MboxStorageReader, PersonalStorage, string, MailHandler)

The above BOLD PersonalStorage is output, the method also returns a converted PST? What’s happening? 2 output files?!
Thanks.

will this work?

Dim counter As Integer = 0

Sub MBoxCounter(ByVal message As MailMessage)
    counter += 1
End Sub

storage = MailStorageConverter.MboxToPst("source.mbox", "target.pst", AddressOf MBoxCounter)

This can be used to chain pst processing.

var somePst = PersonalStorage.Create(...);

// convert mbox 1 to "Deleted Items" folder and add "Sent Items" folder.
MailStorageConverter.MboxToPst(MboxReader1, somePst, "Deleted Items", null).RootFolder.AddSubfolder("Sent Items");
// convert mbox 2 to "Sent Items" folder and add "Inbox" folder.
MailStorageConverter.MboxToPst(MboxReader2, somePst, "Sent Items", null).RootFolder.AddSubfolder("Inbox");
// convert mbox 3 to "Inbox" folder.
somePst = MailStorageConverter.MboxToPst(MboxReader3, somePst, "Inbox", null);
// etc
...

Thanks, but no, tested inside VS.net 2013 Pro, not sure if its overloads are correct or my vs has lack of some newer features.

BTW, it just reflects the processed message number, I hope an event to get that data plus possibility to cancel the process will be added, never found why Email developers don’t like to have events :slight_smile:

That’s weird, if your vs works with events, it should support delegates as well.

In any case, EMAILNET-40949 has previously been created which will improve the MailStorageConverter event model.

Hello,
Seems there’s a related ticket here but no idea about its status.

As mentioned in the previous thread, a new converter is being developed and will be out soon.