Garbage collector call

Hello
When saving items from large Pst storages, shall we call GC.Collect() per hundred of messages processed?
Thanks

Hi @australian.dev.nerds
Thanks for your question.
We’ll try to have an answer by Monday.

1 Like

Hello and thanks, if you don’t mind may I also ask the difference between these 3 and the preferred one to be scheduled for the next week?

Note that I will set both Rtf and Html parts, so first I use:
MSG.SetBodyContent(MyHTM, BodyContentType.Html, False)
Then will proceed to:

MSG.SetBodyContent(Encoding.ASCII.GetString(MyRTF.ToArray), BodyContentType.Rtf, False)
vs
MSG.SetBodyRtf(Encoding.ASCII.GetString(MyRTF.ToArray), False)
vs
MSG.BodyRtf = Encoding.ASCII.GetString(MyRTF.ToArray)

Hi @australian.dev.nerds

If you use this method, the BodyContentType of the message will be Html

In the remaining 3 cases, the BodyContentType of the message will be Rtf.
All 3 cases are equal because inside the dll is using MSG.SetBodyRtf(Encoding.ASCII.GetString(MyRTF.ToArray), False).
for all of these methods.

1 Like

Hello,
Thanks, the only thing not clear, if I set both:

MSG.SetBodyContent(MyHTM, BodyContentType.Html, False)
and
MSG.SetBodyRtf(Encoding.ASCII.GetString(MyRTF.ToArray), False)

What happens?

Also, the new 23.6 build showed up an error:

Dim MyCardContact As Email.PersonalInfo.Contact = Email.PersonalInfo.Contact.Load(source, Email.PersonalInfo.ContactLoadFormat.WebDav)

Warning: Aspose.Email.PersonalInfo.Contact is obsolete: This class is deprecated and will be removed soon, use the VCardContact and MapiContact classes to work with contacts.

OK but how do they support loading of ContactLoadFormat.WebDav?
I mean VCardContact or MapiContact support loading CardDav WebDav like PersonalInfo.Contact?

When saving contacts from PST, cannot save Msg directly as Eml, you already provided:

Dim vcard As VCardContact = VCardContact.Load(fileName)
Dim eml As MailMessage = New MailMessage() With {.Subject = vcard.IdentificationInfo.DisplayName}
Dim ms As MemoryStream = New MemoryStream()
vcard.Save(ms)
eml.AlternateViews.Add(New AlternateView(ms, New ContentType(“text/vcard”)))

This works, but what about Calendar Items/ Events/ Exceptions?
Can be saved directly from Msg to Eml or also will need a similar way to go? :slight_smile:

Hi @australian.dev.nerds

The last value will be set as message’s body.

We will provide possibility to load WebDav into VCardContact or MapiContact before removing Contact

We provided method Appointment.ToMailmessage() , hope this help.
Also we plan add VCardContact.ToMailmessage() in future.

1 Like

Sure, very helpful.

Hopefully it will internally implement?
eml.AlternateViews.Add(New AlternateView(ms, New ContentType(“text/vcard”)))

Anyway, when saving ics as eml, the ics itself is attached as meeting.ics
To have the same behavior with contact, I mean saving vcf as eml, attach the vcf to eml named contact.vcf what’s the best approach? And possible to have it in the future VCardContact.ToMailmessage() method?
Thanks :slight_smile:

Yes, it will be implemented exactly this way.

1 Like

Thanks, when saving vcf contact as msg and/or eml how to force the save module to attach the vcf file itself to the target email message?

Currently not embedded support, but can you please share a sample to add such attachment when saving as Msg and Eml ?

Hello @australian.dev.nerds,

Please try the following code:

Dim vcard As VCardContact = VCardContact.Load("my.vcf")

    Using ms As MemoryStream = New MemoryStream()
        vcard.Save(ms, ContactSaveFormat.Msg)
        Dim eml As MailMessage = MailMessage.Load(ms)
        eml.Save("my.eml")
    End Using

When saving MailMessage in eml, the vcf content will be attached as text/vcard AlternateVIew.

I hope it helps you. Thanks.

Thanks, to set the MapiMessage plain text part:
MapiMessage.Body
vs
MapiMessage.SetBodyContent(bodyString, BodyContentType.PlainText, False)
Any difference? Or which one is called internally for both?

SetBodyContent (body, type, COMPRESSION) The last parameter: Compression - will have effect on Rtf part only? or all parts?
Thanks :slight_smile:

@australian.dev.nerds,

MapiMessage.Body sets the text body only.

MapiMessage.SetBodyContent sets all properties (PidTagRtfCompressed, PidTagBody, PidTagRtfInSync) that relate to the message content. The Compression parameter applies only to a property that contains RTF.