2016-04-04 12 views
1

未読メール(Outlook)をチェックし、添付ファイルを取得して保存するアプリケーションで作業中です。その後、私は同じメールで実行されませんので、このメールを読んでマークします。しかし、Outlookで未読としてマークされたメール。 私はこのようにそれを書く:OutlookのメールアイテムをC#コードで読み取れないとマークする

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); 
     } 
+0

私はOutlookを使用しませんが、読み取りボックスがある場合は、変更を保存する前に読んだメールを移動してみてください。 –

答えて

1

変更 "偽NewMail.UnRead =;" 〜 "newMail.UnRead = false;"

関連する問題