2010-06-02 72 views

回答

0

喜希望這個代碼將會幫助你 ** 1.設置屬性

udfSetPropertyG("Mail Status", GlobalVariables.sPaymentClose, mailitem); 
    public void udfSetPropertyG(string sPropName, string sPropValue, OutLook.MailItem mailItem) 
      { 
       OutLook.UserProperty oOlProperty = default(OutLook.UserProperty); 
       oOlProperty = mailItem.UserProperties.Add(sPropName, OutLook.OlUserPropertyType.olText); 
       if ((oOlProperty == null)) 
       { 
        oOlProperty = mailItem.UserProperties.Add(sPropName, OutLook.OlUserPropertyType.olText); 
       } 
       oOlProperty.Value = sPropValue; 
      } 

2.適用領域的前景,然後同樣的郵件

udsShowUDFields("Mail Status", mailitem); 

      public void udsShowUDFields(string sFldName, OutLook.MailItem mailItem) 
      { 

       var _with1 = oOlApp.ActiveExplorer().CurrentView as OutLook.TableView; 
       try 
       { 

        if (_with1.ViewType == OutLook.OlViewType.olTableView) 
        { 
         _with1.ViewFields.Add(sFldName); 
         _with1.Apply(); 
        } 
       } 
       catch (Exception ex) 
       { 
        _with1.Apply(); 
       } 
      } 

3.save郵件項目

mailitem.Save(); 
相關問題