Skip to content

Instantly share code, notes, and snippets.

@aspose-com-gists
Created September 26, 2025 15:27
Show Gist options
  • Save aspose-com-gists/ead680c96df4e46d4edc49f7c55f4632 to your computer and use it in GitHub Desktop.
Save aspose-com-gists/ead680c96df4e46d4edc49f7c55f4632 to your computer and use it in GitHub Desktop.
Convert Outlook VCF to HTML and HTML to VCF in C#
var msg = MapiContact.FromVCard("contact.vcf").GetUnderlyingMessage();
var htmlSaveOptions = new HtmlSaveOptions
{
HtmlFormatOptions = HtmlFormatOptions.RenderVCardInfo | HtmlFormatOptions.WriteHeader
};
msg.Save("contact.html", htmlSaveOptions);
var content = File.ReadAllText("content.html");
var contact = new MapiContact
{
NameInfo = { DisplayName = "somebody" },
ElectronicAddresses = { Email1 = { EmailAddress = "[email protected]" } }
};
contact.SetBodyContent(content, BodyContentType.Html);
contact.Save("contact.vcf", ContactSaveFormat.VCard);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment