[英]How to mark mail item as read?
我正在開發一個應用程序來將附加文件保存在未讀的 Outlook 郵件中。
之后我想將郵件標記為已讀,這樣它就不會在相同的郵件上運行。
郵件仍標記為未讀。
我是這樣寫的:
try
{
foreach (object collectionItem in inBoxItems)
{
newEmail = collectionItem as Outlook.MailItem;
if (newEmail != null)
{
if (newEmail.Attachments.Count > 0)
{
for (int i = 1; i <= newEmail.Attachments.Count; i++)
{
string filePath = Path.Combine(destination,newEmail.Attachments[i].FileName);
newEmail.Attachments[i].SaveAsFile(filePath);
}
NewMail.UnRead = false;
NewMail.Save();
flag = true;
}
}
}
if (flag == true)
{
MessageBox.Show("saved!");
flag = false;
}
else
MessageBox.Show("not saved");
}
catch (Exception ex)
{
string errorInfo = (string)ex.Message.Substring(0, 11);
MessageBox.Show(ex.Message);
}
更改NewMail.UnRead = false;
到newMail.UnRead = false;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.