Witam Muszę czytać załącznik i obraz liniowy oddzielnie w lokalnym katalogu z programu Outlook 2010 przy użyciu C#. Użyłem w tym celu koncepcji własności i treści. Używam następujący kod do tego, ale teraz działa.Jak rozróżnić obraz Inline i załącznik w programie Outlook 2010 [C#]
if (mailItem.Attachments.Count > 0)
{
/*for (int i = 1; i <= mailItem.Attachments.Count; i++)
{
string filePath = Path.Combine(destinationDirectory, mailItem.Attachments[i].FileName);
mailItem.Attachments[i].SaveAsFile(filePath);
AttachmentDetails.Add(filePath);
}*/
foreach (Outlook.Attachment atmt in mailItem.Attachments)
{
MessageBox.Show("inside for each loop");
prop = atmt.PropertyAccessor;
string contentID = (string)prop.GetProperty(SchemaPR_ATTACH_CONTENT_ID);
MessageBox.Show("content if is " +contentID);
if (contentID != "")
{
MessageBox.Show("inside if loop");
string filePath = Path.Combine(destinationDirectory, atmt.FileName);
MessageBox.Show(filePath);
atmt.SaveAsFile(filePath);
AttachmentDetails.Add(filePath);
}
else
{
MessageBox.Show("inside else loop");
string filePath = Path.Combine(destinationDirectoryT, atmt.FileName);
atmt.SaveAsFile(filePath);
AttachmentDetails.Add(filePath);
}
}
}
pomóż w toku ....
Łańcuch SchemaPR_ATTACH_CONTENT_ID = @ "http://schemas.microsoft.com/mapi/proptag/0x3712001E"; – zytham