private void LoadMessageID() { IEFolder folderFirst = OutlookSession.OpenFolder(_folderFirst.FolderIDs.EntryId, _folderFirst.FolderIDs.StoreId); Assert.IsNotNull(folderFirst); using ( folderFirst ) { IEMessages messages = folderFirst.GetMessages(); Assert.IsNotNull(messages); using ( messages ) { if (messages.GetCount() == 0) { Assert.Fail("Source folder should have at least one message"); } if (messages.GetCount() != 1) { Assert.Fail("Source folder should have one message"); } IEMessage message = messages.OpenMessage(0); Assert.IsNotNull(message); using ( message ) { _messageID = OutlookSession.GetMessageID(message); _recordKey = message.GetBinProp(MAPIConst.PR_RECORD_KEY); } } } Assert.IsNotNull(_messageID); }
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; } }