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

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -