/// <summary> /// Verify the MessageEntryID structure. /// </summary> /// <param name="messageEntryID">The MessageEntryID to be verified.</param> private void VerifyMessageEntryID(MessageEntryID messageEntryID) { // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCDATA_R2236"); // Verify MS-OXCDATA requirement: MS-OXCDATA_R2236. Site.CaptureRequirementIfAreEqual<int>( 0, BitConverter.ToInt32(messageEntryID.Flag, 0), "MS-OXCDATA", 2236, @"[In Message EntryID Structure] Flags (4 bytes): This value MUST be set to 0x00000000."); // Add the debug information. int messageType = BitConverter.ToInt16(messageEntryID.MessageType, 0); Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCDATA_R2239, The actual value of MessageType is {0}", messageType); // Verify MS-OXCDATA requirement: MS-OXCDATA_R2239. bool isVerifyR2239 = messageType == 0x0001 || messageType == 0x0003 || messageType == 0x0005 || messageType == 0x0007 || messageType == 0x0009 || messageType == 0x000B || messageType == 0x000C; Site.CaptureRequirementIfIsTrue( isVerifyR2239, "MS-OXCDATA", 2239, @"[In Message EntryID Structure] MessageType (2 bytes): One of several Store object types specified in the table in section 2.2.4."); // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCDATA_R2241"); // Verify MS-OXCDATA requirement: MS-OXCDATA_R2241. Site.CaptureRequirementIfIsTrue( Common.IsGUID(messageEntryID.FolderDataBaseGUID), "MS-OXCDATA", 2241, @"[In Message EntryID Structure] FolderDatabaseGuid (16 bytes): A GUID associated with the Store object of the folder in which the message resides and corresponding to the DatabaseReplicationId field of the folder ID structure."); // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCDATA_R2242"); // Verify MS-OXCDATA requirement: MS-OXCDATA_R2242. Site.CaptureRequirementIfAreEqual<int>( 6, messageEntryID.FolderGlobalCounter.Length, "MS-OXCDATA", 2242, @"[In Message EntryID Structure] FolderGlobalCounter (6 bytes): An unsigned integer identifying the folder in which the message resides."); // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCDATA_R2243"); // Verify MS-OXCDATA requirement: MS-OXCDATA_R2243. Site.CaptureRequirementIfAreEqual<short>( 0, BitConverter.ToInt16(messageEntryID.Pad, 0), "MS-OXCDATA", 2243, @"[In Message EntryID Structure] Pad (2 bytes): This value MUST be set to zero."); // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCDATA_R2244"); // Verify MS-OXCDATA requirement: MS-OXCDATA_R2244. Site.CaptureRequirementIfIsTrue( Common.IsGUID(messageEntryID.FolderDataBaseGUID), "MS-OXCDATA", 2244, @"[In Message EntryID Structure] MessageDatabaseGuid (16 bytes): A GUID associated with the Store object of the message and corresponding to the DatabaseReplicationId field of the message ID structure."); // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCDATA_R2245"); // Verify MS-OXCDATA requirement: MS-OXCDATA_R2245. Site.CaptureRequirementIfAreEqual<int>( 6, messageEntryID.FolderGlobalCounter.Length, "MS-OXCDATA", 2245, @"[In Message EntryID Structure] MessageGlobalCounter (6 bytes): An unsigned integer identifying the message."); // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCDATA_R2246"); // Verify MS-OXCDATA requirement: MS-OXCDATA_R2246. Site.CaptureRequirementIfAreEqual<short>( 0, BitConverter.ToInt16(messageEntryID.Pad, 0), "MS-OXCDATA", 2246, @"[In Message EntryID Structure] Pad (2 bytes): This value MUST be set to zero."); // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCDATA_R2237"); // Verify MS-OXCDATA requirement: MS-OXCDATA_R2237. Site.CaptureRequirementIfAreEqual<byte[]>( this.mailboxGUID, messageEntryID.ProviderUID, "MS-OXCDATA", 2237, @"[In Message EntryID Structure,ProviderUID (16 bytes):] For a folder in a private mailbox, this value MUST be set to the value of the MailboxGuid field from the RopLogon ROP response buffer ([MS-OXCROPS] section 2.2.3.1)."); }
/// <summary> /// Get message EntryID bytes array. /// </summary> /// <param name="folderHandle">Folder handle which the message exist.</param> /// <param name="folderId">Folder id value.</param> /// <param name="messageHandle">message handle.</param> /// <param name="messageId">Message id value.</param> /// <returns>Message EntryID bytes array.</returns> public byte[] GetMessageEntryId(uint folderHandle, ulong folderId, uint messageHandle, ulong messageId) { // Get the message longterm ID. RopLongTermIdFromIdResponse ropLongTermIdOfMessage = this.GetLongTermId(messageHandle, messageId); // Get inbox folder's longterm ID. RopLongTermIdFromIdResponse ropLongTermIdOfInboxFolder = this.GetLongTermId(folderHandle, folderId); MessageEntryID messageEntryId; // Get message's entry ID. messageEntryId = new MessageEntryID(this.mailboxGUID, ropLongTermIdOfInboxFolder.LongTermId.DatabaseGuid, ropLongTermIdOfInboxFolder.LongTermId.GlobalCounter, ropLongTermIdOfMessage.LongTermId.DatabaseGuid, ropLongTermIdOfMessage.LongTermId.GlobalCounter); this.VerifyMessageEntryID(messageEntryId); return messageEntryId.Serialize(); }