こんにちは、C#を使用してOutlook 2010からローカルディレクトリに別途添付ファイルとインラインイメージを読み込む必要があります。私はこのためにプロパティとコンテンツIDの概念を使用しました。私はそれを行うために次のコードを使用していますが、現在は動作しています。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);
}
}
}
これは私のために働いたものです
文字列SchemaPR_ATTACH_CONTENT_ID = @ "" http://schemas.microsoft.com/mapi/proptag/0x3712001E "; – zytham