C#Redemption包装类没有触发事件

时间:2011-05-20 14:34:08

标签: c# outlook outlook-addin outlook-redemption

我使用Redemption为Outlook加载项编写了以下包装类:

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 是一个全局变量。

我可以看到正在填充 watchedPSTs ,但是当将邮件移动到PST时,这些项目永远不会被激活。想法?

由于

1 个答案:

答案 0 :(得分:1)

如何初始化RDOSession?您是否从OOM调用Logon或将RDOSession.MAPIOBJECT设置为Namespace.MAPIOBJECT? 是在全球(类)级别上观看的PST列表? 你使用多线程吗?