我怎样才能获得Outlook联系人的头像图片? [英] How can I get the outlook contact's avatar image?
本文介绍了我怎样才能获得Outlook联系人的头像图片?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想获得该联系人的头像图片
I am trying to get the 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;
for (var i = 0; i < items.Count; ++i)
{
var contact = items[i + 1] as ContactItem;
if (contact == null)
continue;
if (contact.HasPicture)
{
// TODO store the picture somehow.
}
}
}
}
不过,不幸的是我无法找到一个图片的访问。
But unfortunately I can't find a picture accessor.
推荐答案
您可以使用附件
的 ContactItem
的属性:
contact.Attachments["ContactPicture.jpg"]
如果您想将文件保存到磁盘上,例如,你可以做是这样的:
If you want to save the file to disk, for example, you could do something like this:
contact.Attachments["ContactPicture.jpg"].SaveAsFile(@"{some_path}\ContactPicture.jpg")
这篇关于我怎样才能获得Outlook联系人的头像图片?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文