c# - How can I get the outlook contact's avatar image? -
i trying contact's avatar image.
using microsoft.office.interop.outlook; public sealed class outlookavatarfetcher { private static void fetchavatars() { var outlook = new application(); var folder = outlook.getnamespace("mapi").getdefaultfolder(oldefaultfolders.olfoldercontacts); var items = folder.items; (var = 0; < items.count; ++i) { var contact = items[i + 1] contactitem; if (contact == null) continue; if (contact.haspicture) { // todo store picture somehow. } } } } but unfortunately can't find picture accessor.
you can use attachments property of contactitem:
contact.attachments["contactpicture.jpg"] if want save file disk, example, this:
contact.attachments["contactpicture.jpg"].saveasfile(@"{some_path}\contactpicture.jpg")
Comments
Post a Comment