Пример #1
0
            public override void OnMailMove(MAPIFullNtf ntf)
            {
                Console.WriteLine("OnMailMove: " + _count);
                Console.WriteLine("ntf.EntryID: " + ntf.EntryID);
                Console.WriteLine("ntf.OntryID: " + ntf.OldEntryID);
                IEMessage message   = null;
                string    msgId     = null;
                string    recordKey = null;

                switch (_count)
                {
                case 0:
                    message = OutlookSession.OpenMessage(ntf.EntryID, _storeID);
                    if (message == null)
                    {
                        return;
                    }
                    Console.WriteLine("Subject + " + message.GetStringProp(MAPIConst.PR_SUBJECT));

                    Assert.IsNotNull(message);
                    using ( message )
                    {
                        msgId     = OutlookSession.GetMessageID(message);
                        recordKey = message.GetBinProp(MAPIConst.PR_RECORD_KEY);
                    }
                    Console.WriteLine("Id1: " + msgId);
                    Console.WriteLine("Id2: " + _messageID);
                    if (msgId != _messageID)
                    {
                        if (recordKey == _recordKey)
                        {
                            _messageID = msgId;
                        }
                        else
                        {
                            return;
                        }
                    }
                    Console.WriteLine("PID = " + ntf.ParentID);
                    Console.WriteLine("OID = " + ntf.OldParentID);
                    Console.WriteLine("FID = " + _folderFirst.FolderIDs.EntryId);
                    Console.WriteLine("SID = " + _folderSecond.FolderIDs.EntryId);
                    Assert.AreEqual(GetFolderID(ntf.ParentID), _folderSecond.FolderIDs.EntryId);
                    Assert.AreEqual(GetFolderID(ntf.OldParentID), _folderFirst.FolderIDs.EntryId);
                    ++_count;
                    _complete = true;
                    break;

                case 1:
                    message = OutlookSession.OpenMessage(ntf.EntryID, _storeID);
                    if (message == null)
                    {
                        return;
                    }
                    Console.WriteLine(message.GetStringProp(MAPIConst.PR_SUBJECT));

                    Assert.IsNotNull(message);
                    using ( message )
                    {
                        msgId     = OutlookSession.GetMessageID(message);
                        recordKey = message.GetBinProp(MAPIConst.PR_RECORD_KEY);
                    }
                    Console.WriteLine("Id1: " + msgId);
                    Console.WriteLine("Id2: " + _messageID);
                    if (msgId != _messageID)
                    {
                        if (recordKey == _recordKey)
                        {
                            _messageID = msgId;
                        }
                        else
                        {
                            return;
                        }
                    }
                    Assert.AreEqual(GetFolderID(ntf.ParentID), _folderFirst.FolderIDs.EntryId);
                    Assert.AreEqual(GetFolderID(ntf.OldParentID), _folderSecond.FolderIDs.EntryId);
                    ++_count;
                    _complete = true;
                    break;
                }
            }