2016-04-04 25 views
1

Bir uygulama üzerinde çalışan okunmamış e-posta (Outlook) kontrol ve ekli fiels alır ve bunları kaydedin. Bundan sonra bu e-postanın okunmuş olarak işaretlenmesini istiyorum, böylece aynı e-postalarda çalışmaz. Ancak posta hala Outlook'ta okunmadı olarak işaretlendi. i bu gibi yazmak:Outlook posta öğesinin okunmadı olarak okunması okunmadı C# kodu

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 kullanmıyorum, ancak bir Okuma kutusu varsa, değişiklikleri kaydetmeden önce oradaki e-postalarınızı oraya taşımayı deneyin. –

cevap

1

Değiştir "NewMail.UnRead = false;" "newMail.UnRead = false;"

İlgili konular