2011-05-20 41 views
0

我已經寫了下面的包裝類爲Outlook添加事件,在使用贖回:使用此代碼C#贖回包裝類不點火

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text; 
using System.Diagnostics; 

namespace PSTAttachRemove_Redemption 
{ 
    class PSTWatch 
    { 
     private Redemption.RDOPstStore pst; 

     public PSTWatch(Redemption.RDOPstStore rPST) 
     { 
      pst = rPST; 
      pst.OnMessageMoved += new Redemption.IRDOStoreEvents_OnMessageMovedEventHandler(pst_OnMessageMoved); 
     } 

     void pst_OnMessageMoved(string EntryID) 
     { 
      Debug.Print(EntryID); 
     } 
    } 
} 

在我的主要加載代碼,我調用這個包裝:

void FileStorePopulation(Redemption.RDOStore store) 
{ 
    switch (store.StoreKind) 
    { 
     case TxStoreKind.skPstAnsi: 
     case TxStoreKind.skPstUnicode: 
      PSTWatch p = new PSTWatch(store as RDOPstStore); 
      watchedPSTs.Add(store.EntryID, p); 
      break; 
    } 
} 

其中watchedPSTs是一個全局變量。

我可以看到觀看了PSTT正在填充,但在將郵件移動到PST時不會觸發項目。想法?

謝謝

回答

1

如何初始化RDOSession?你是否調用登錄或從OOM中將RDOSession.MAPIOBJECT設置爲Namespace.MAPIOBJECT? 是watched在全球(class)級聲明的PST列表? 你使用多個線程嗎?

+0

全局來自主加載項。我改變了我的方法,只是監測項目。在Redemption Group線程上有更多的代碼(這與我的CopyTo加載項有關) – 2011-05-20 19:01:02