B
Battistaar
Hi all, in my software i need to retrieve outlook contact picture, this is my
code to do that in c#:
private Image getOutlookPicture(Outlook.ContactItem contact)
{
Image img;
img = Properties.Resources.user; //default image
foreach (Outlook.Attachment at in contact.Attachments)
{
if (at.FileName == "ContactPicture.jpg" || at.FileName ==
"ContactPhoto")
{
string fullName ="temp.jpg";
at.SaveAsFile(fullName);
FileStream tempStream = new FileStream(fullName,
FileMode.Open);
img = Image.FromStream(tempStream);
tempStream.Close();
File.Delete(fullName);
}
}
return img;
}
all work fine when i find a ContactPhoto, with ContactPicture.jpg it throws
a COMException saying that it is unamble to save the attachment and
suggesting me to control folder's permission. I'm an amministrator user, and
with ContactPhoto file all work fine, so it's strange.
any idea?
and anyone knows why are some picture saved as ContactPicture.jpg and
someother as ContactPhoto?
code to do that in c#:
private Image getOutlookPicture(Outlook.ContactItem contact)
{
Image img;
img = Properties.Resources.user; //default image
foreach (Outlook.Attachment at in contact.Attachments)
{
if (at.FileName == "ContactPicture.jpg" || at.FileName ==
"ContactPhoto")
{
string fullName ="temp.jpg";
at.SaveAsFile(fullName);
FileStream tempStream = new FileStream(fullName,
FileMode.Open);
img = Image.FromStream(tempStream);
tempStream.Close();
File.Delete(fullName);
}
}
return img;
}
all work fine when i find a ContactPhoto, with ContactPicture.jpg it throws
a COMException saying that it is unamble to save the attachment and
suggesting me to control folder's permission. I'm an amministrator user, and
with ContactPhoto file all work fine, so it's strange.
any idea?
and anyone knows why are some picture saved as ContactPicture.jpg and
someother as ContactPhoto?