Hi
I am creating an outlook add-in in vb.net. I
want to get the path of contact picture. I have successfully add
contact picture in outlook programmatic ally but i want to check the
path programmatic ally also, where picture is added(saved) in outlook
and want to show this path on a label control.
I am using vb.net 2005 and outlook 2003.
Thanks
Loading
Dharmchand DhingraPosted Nov 9, 2009, 1:55 AM
Thanks for quick response and it's solved my problem.
Thank you
Regards
Dharmchand Dhingra
Master BillaPosted Nov 7, 2009, 11:11 PM
Yes i have done this type project last year
here my code to that.
Methods
public static string GetContactPicturePath(Microsoft.Office.Interop.Outlook.ContactItem contact)
{
return GetContactPicturePath(contact, System.IO.Path.GetTempPath());
}
public static string GetContactPicturePath(Microsoft.Office.Interop.Outlook.ContactItem contact, string path)
{
string picturePath = "";
if (contact.HasPicture)
{
foreach (Microsoft.Office.Interop.Outlook.Attachment att in contact.Attachments)
{
if (att.DisplayName == "ContactPicture.jpg")
{
try
{
picturePath = System.IO.Path.GetDirectoryName(path) + "\\Contact_" + contact.EntryID + ".jpg";
if (!System.IO.File.Exists(picturePath))
att.SaveAsFile(picturePath);
}
catch
{
picturePath = "";
}
}
}
}
return picturePath;
}
How to use this code
You just loop the every contact object and the do thisMicrosoft.Office.Interop.Outlook.ContactItem contact = (Microsoft.Office.Interop.Outlook.ContactItem)value;
string picturePath = OutlookProvider.GetContactPicturePath(contact);
if its help please make it answerThank you