2011-05-20 40 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