public void MSOXCMSG_S04_TC03_RetentionAndArchivePropertiesOnMessageObject() { this.CheckMapiHttpIsSupported(); this.ConnectToServer(ConnectionType.PrivateMailboxServer); #region Call RopLogon to logon the private mailbox. RopLogonResponse logonResponse = this.Logon(LogonType.Mailbox, out this.insideObjHandle); #endregion #region Call RopCreateMessage to create a Message object. uint targetMessageHandle = this.CreatedMessage(logonResponse.FolderIds[4], this.insideObjHandle); #endregion #region Call SetPropertiesSpecific to set the retention property of the created message. List<PropertyObj> propertyList = new List<PropertyObj> { new PropertyObj(PropertyNames.PidTagArchiveTag, PropertyHelper.GetBinaryFromGeneral(Guid.NewGuid().ToByteArray())), new PropertyObj(PropertyNames.PidTagPolicyTag, PropertyHelper.GetBinaryFromGeneral(Guid.NewGuid().ToByteArray())), new PropertyObj(PropertyNames.PidTagRetentionPeriod, BitConverter.GetBytes(0x00000001)) }; List<byte> lstBytes = new List<byte>(); lstBytes.AddRange(BitConverter.GetBytes(0x00000001)); lstBytes.AddRange(BitConverter.GetBytes(DateTime.Parse(TestDataOfDateTime).ToFileTimeUtc())); propertyList.Add(new PropertyObj(PropertyNames.PidTagStartDateEtc, PropertyHelper.GetBinaryFromGeneral(lstBytes.ToArray()))); propertyList.Add(new PropertyObj(PropertyNames.PidTagRetentionDate, BitConverter.GetBytes(DateTime.Parse(TestDataOfDateTime).ToFileTimeUtc()))); propertyList.Add(new PropertyObj(PropertyNames.PidTagRetentionFlags, BitConverter.GetBytes(0x00000002))); propertyList.Add(new PropertyObj(PropertyNames.PidTagArchivePeriod, BitConverter.GetBytes(0x00000002))); propertyList.Add(new PropertyObj(PropertyNames.PidTagArchiveDate, BitConverter.GetBytes(DateTime.Parse(TestDataOfDateTime).ToFileTimeUtc()))); this.SetPropertiesForMessage(targetMessageHandle, propertyList); #endregion #region Call RopSaveChangesMessage to save created message. RopSaveChangesMessageResponse saveChangesMessageResponse = this.SaveMessage(targetMessageHandle, (byte)SaveFlags.ForceSave); Site.Assert.AreEqual<uint>(TestSuiteBase.Success, saveChangesMessageResponse.ReturnValue, "Call RopSaveChangesMessage should success."); #endregion #region Call RopGetPropertiesAll to get all properties of created message. RopGetPropertiesAllRequest getPropertiesAllRequest = new RopGetPropertiesAllRequest() { RopId = (byte)RopId.RopGetPropertiesAll, LogonId = CommonLogonId, InputHandleIndex = CommonInputHandleIndex, // Set PropertySizeLimit,which specifies the maximum size allowed for a property value returned, // as specified in [MS-OXCROPS] section 2.2.8.4.1. PropertySizeLimit = 0xFFFF, WantUnicode = 1 }; // In process, call capture code to verify adapter requirement this.ResponseSOHs = this.MSOXCMSGAdapter.DoRopCall(getPropertiesAllRequest, targetMessageHandle, ref this.response, ref this.rawData, GetPropertiesFlags.MessageProperties); RopGetPropertiesAllResponse getPropertiesAllResponse = (RopGetPropertiesAllResponse)this.response; Site.Assert.AreEqual<uint>(TestSuiteBase.Success, getPropertiesAllResponse.ReturnValue, "Call RopGetPropertiesAll should success."); List<PropertyObj> ps = PropertyHelper.GetPropertyObjFromBuffer(getPropertiesAllResponse); #region Verify requirements PropertyObj pidTagArchiveTag = PropertyHelper.GetPropertyByName(ps, PropertyNames.PidTagArchiveTag); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R579"); // Verify MS-OXCMSG requirement: MS-OXCMSG_R579 this.Site.CaptureRequirementIfIsNotNull( pidTagArchiveTag, 2194, @"[In PidTagArchiveTag Property] The PidTagArchiveTag property can be present on Message objects."); PropertyObj pidTagPolicyTag = PropertyHelper.GetPropertyByName(ps, PropertyNames.PidTagPolicyTag); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R581"); // Verify MS-OXCMSG requirement: MS-OXCMSG_R581 this.Site.CaptureRequirementIfIsNotNull( pidTagPolicyTag, 2113, @"[In PidTagPolicyTag Property] The PidTagPolicyTag property can be present on Message objects."); PropertyObj pidTagRetentionPeriod = PropertyHelper.GetPropertyByName(ps, PropertyNames.PidTagRetentionPeriod); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R1658"); // Verify MS-OXCMSG requirement: MS-OXCMSG_R1658 this.Site.CaptureRequirementIfIsNotNull( pidTagRetentionPeriod, 2119, @"[In PidTagRetentionPeriod Property] The PidTagRetentionPeriod property can be present on Message objects."); PropertyObj pidTagStartDateEtc = PropertyHelper.GetPropertyByName(ps, PropertyNames.PidTagStartDateEtc); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R176"); byte[] startDateEtc = (byte[])pidTagStartDateEtc.Value; int count = BitConverter.ToInt16(startDateEtc, 0); byte[] defaultRetentionPeriod = new byte[4]; byte[] startDate = new byte[startDateEtc.Length - 4 - 2]; Array.Copy(startDateEtc, 2, defaultRetentionPeriod, 0, 4); Array.Copy(startDateEtc, 6, startDate, 0, startDate.Length); DateTime start = DateTime.FromFileTimeUtc(BitConverter.ToInt64(startDate, 0)); Site.Assert.IsNotNull(start, "The start date should not null."); // Verify MS-OXCMSG requirement: MS-OXCMSG_R176 this.Site.CaptureRequirementIfAreEqual<int>( count - 4, startDate.Length, 2131, @"[In PidTagStartDateEtc Property] [The length of] Start date [is 8 bytes], [which contains] The date, in UTC, from which the age of the Message object is calculated."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R177"); // Verify MS-OXCMSG requirement: MS-OXCMSG_R177 this.Site.CaptureRequirementIfIsNotNull( pidTagStartDateEtc, 2133, @"[In PidTagStartDateEtc Property] The PidTagStartDateEtc property can be present only on Message objects."); PropertyObj pidTagRetentionDate = PropertyHelper.GetPropertyByName(ps, PropertyNames.PidTagRetentionDate); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R181"); // Verify MS-OXCMSG requirement: MS-OXCMSG_R181 this.Site.CaptureRequirementIfIsNotNull( pidTagRetentionDate, 2136, @"[In PidTagRetentionDate Property] The PidTagRetentionDate property can be present only on Message objects."); PropertyObj pidTagRetentionFlags = PropertyHelper.GetPropertyByName(ps, PropertyNames.PidTagRetentionFlags); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R585"); // Verify MS-OXCMSG requirement: MS-OXCMSG_R585 this.Site.CaptureRequirementIfIsNotNull( pidTagRetentionFlags, 2149, @"[In PidTagRetentionFlags Property] The PidTagRetentionFlags property can be present on Message objects."); PropertyObj pidTagArchivePeriod = PropertyHelper.GetPropertyByName(ps, PropertyNames.PidTagArchivePeriod); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R207"); // Verify MS-OXCMSG requirement: MS-OXCMSG_R207 this.Site.CaptureRequirementIfIsNotNull( pidTagArchivePeriod, 2165, @"[In PidTagArchivePeriod Property] The PidTagArchivePeriod property can be present on Message objects."); PropertyObj pidTagArchiveDate = PropertyHelper.GetPropertyByName(ps, PropertyNames.PidTagArchiveDate); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R214"); // Verify MS-OXCMSG requirement: MS-OXCMSG_R214 this.Site.CaptureRequirementIfIsNotNull( pidTagArchiveDate, 2174, @"[In PidTagArchiveDate Property] The PidTagArchiveDate property can be present on only Message objects, not on folders."); #endregion #endregion #region Call RopRelease to release the created message. this.ReleaseRop(targetMessageHandle); #endregion }
public void MSOXCMSG_S08_TC04_AttachmentObjectProperties() { this.CheckMapiHttpIsSupported(); this.ConnectToServer(ConnectionType.PrivateMailboxServer); #region Call RopLogon to log on a mailbox. RopLogonResponse logonResponse = this.Logon(LogonType.Mailbox, out this.insideObjHandle); #endregion #region Call RopCreateMessage to create a message uint targetMessageHandle = this.CreatedMessage(logonResponse.FolderIds[4], this.insideObjHandle); #endregion #region Call RopSaveChangesMessage to save the message RopSaveChangesMessageResponse saveChangesMessageResponse; saveChangesMessageResponse = this.SaveMessage(targetMessageHandle, (byte)SaveFlags.ForceSave); Site.Assert.AreEqual<uint>(TestSuiteBase.Success, saveChangesMessageResponse.ReturnValue, TestSuiteBase.ROPSucceedMsg); #endregion #region Call RopOpenMessage to open the message. RopOpenMessageResponse openMessageResponse; uint openedMessageHandle = this.OpenSpecificMessage(logonResponse.FolderIds[4], saveChangesMessageResponse.MessageId, this.insideObjHandle, MessageOpenModeFlags.ReadWrite, out openMessageResponse); Site.Assert.AreEqual<uint>(TestSuiteBase.Success, openMessageResponse.ReturnValue, TestSuiteBase.ROPSucceedMsg); #endregion #region Call RopCreateAttachment to create an attachment. RopCreateAttachmentResponse createAttachmentResponse; uint attachmentId; uint attachmentHandle = this.CreateAttachment(openedMessageHandle, out createAttachmentResponse, out attachmentId); #endregion #region Call RopSaveChangesAttachment to save the attachment. RopSaveChangesAttachmentResponse saveChangesAttachmentResponse; this.SaveAttachment(attachmentHandle, out saveChangesAttachmentResponse); #endregion #region Call RopSaveChangesMessage to save the message saveChangesMessageResponse = this.SaveMessage(openedMessageHandle, (byte)SaveFlags.ForceSave); Site.Assert.AreEqual<uint>(TestSuiteBase.Success, saveChangesMessageResponse.ReturnValue, TestSuiteBase.ROPSucceedMsg); #endregion #region Call RopGetPropertiesAll to get all properties of the newly created attachment. RopGetPropertiesAllRequest getPropertiesAllRequest = new RopGetPropertiesAllRequest() { RopId = (byte)RopId.RopGetPropertiesAll, LogonId = CommonLogonId, InputHandleIndex = CommonInputHandleIndex, // Set PropertySizeLimit, which specifies the maximum size allowed for a property value returned, as specified in [MS-OXCROPS]. PropertySizeLimit = 0xFFFF, WantUnicode = (ushort)0 }; this.ResponseSOHs = this.MSOXCMSGAdapter.DoRopCall(getPropertiesAllRequest, attachmentHandle, ref this.response, ref this.rawData, GetPropertiesFlags.AttachmentProperties); #endregion #region Set specific properties which are not initialized during creating the attachment List<PropertyObj> specificProperties = new List<PropertyObj> { new PropertyObj(PropertyNames.PidTagAttachDataBinary, Common.AddInt16LengthBeforeBinaryArray(Common.GetBytesFromUnicodeString(TestDataOfPidTagAttachDataBinary))), new PropertyObj(PropertyNames.PidTagAttachLongPathname, Common.GetBytesFromUnicodeString(TestDataOfPidTagAttachLongPathname)), new PropertyObj(PropertyNames.PidTagAttachTag, Common.AddInt16LengthBeforeBinaryArray(this.testDataOfPidTagAttachTag)), new PropertyObj(PropertyNames.PidTagAttachRendering, Common.AddInt16LengthBeforeBinaryArray(Common.GetBytesFromUnicodeString(TestDataOfPidTagAttachRendering))), new PropertyObj(PropertyNames.PidTagAttachFlags, BitConverter.GetBytes(0x00000004)), new PropertyObj(PropertyNames.PidTagAttachTransportName, Common.GetBytesFromUnicodeString(TestDataOfPidTagAttachTransportName)), new PropertyObj(PropertyNames.PidTagAttachEncoding, Common.AddInt16LengthBeforeBinaryArray(this.testDataOfPidTagAttachEncoding)), new PropertyObj(PropertyNames.PidTagAttachmentLinkId, BitConverter.GetBytes(0x00000000)), new PropertyObj(PropertyNames.PidTagAttachmentFlags, BitConverter.GetBytes(0x00000000)), new PropertyObj(PropertyNames.PidTagAttachMethod, BitConverter.GetBytes(0x00000001)), new PropertyObj(PropertyNames.PidTagAttachmentHidden, BitConverter.GetBytes(true)), new PropertyObj(PropertyNames.PidTagAttachMimeTag, Common.GetBytesFromUnicodeString(TestDataOfPidTagAttachMimeTag)), new PropertyObj(PropertyNames.PidTagAttachContentId, Common.GetBytesFromUnicodeString(TestDataOfPidTagAttachContentId)), new PropertyObj(PropertyNames.PidTagAttachContentLocation, Common.GetBytesFromUnicodeString(TestDataOfPidTagAttachContentLocation)), new PropertyObj(PropertyNames.PidTagAttachContentBase, Common.GetBytesFromUnicodeString(TestDataOfPidTagAttachContentBase)) }; this.SetPropertiesForMessage(attachmentHandle, specificProperties); #endregion #region Send a RopGetPropertiesSpecific request to get all properties of specific message object. PropertyTag[] tagArray = this.CreateAttachmentPropertyTagsForCapture(); RopGetPropertiesSpecificRequest getPropertiesSpecificRequest = new RopGetPropertiesSpecificRequest() { RopId = (byte)RopId.RopGetPropertiesSpecific, LogonId = CommonLogonId, InputHandleIndex = CommonInputHandleIndex, PropertySizeLimit = 0xFFFF, PropertyTagCount = (ushort)tagArray.Length, PropertyTags = tagArray }; this.ResponseSOHs = this.MSOXCMSGAdapter.DoRopCall(getPropertiesSpecificRequest, attachmentHandle, ref this.response, ref this.rawData, GetPropertiesFlags.AttachmentProperties); RopGetPropertiesSpecificResponse getPropertiesSpecificResponse = (RopGetPropertiesSpecificResponse)this.response; Site.Assert.AreEqual<uint>(TestSuiteBase.Success, getPropertiesSpecificResponse.ReturnValue, TestSuiteBase.ROPSucceedMsg); List<PropertyObj> ps = PropertyHelper.GetPropertyObjFromBuffer(tagArray, getPropertiesSpecificResponse); PropertyObj pidTagAttachDataBinary = PropertyHelper.GetPropertyByName(ps, PropertyNames.PidTagAttachDataBinary); PropertyObj pidTagAttachMethod = PropertyHelper.GetPropertyByName(ps, PropertyNames.PidTagAttachMethod); byte[] testDataOfPidTagAttachDataBinary = Common.GetBytesFromUnicodeString(TestDataOfPidTagAttachDataBinary); byte[] valueOfPidTagAttachDataBinary = new byte[testDataOfPidTagAttachDataBinary.Length]; Buffer.BlockCopy((byte[])pidTagAttachDataBinary.Value, 2, valueOfPidTagAttachDataBinary, 0, testDataOfPidTagAttachDataBinary.Length); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R236"); // Verify MS-OXCMSG requirement: MS-OXCMSG_R236 bool isVerfiedR236 = Common.CompareByteArray(testDataOfPidTagAttachDataBinary, valueOfPidTagAttachDataBinary); this.Site.CaptureRequirementIfIsTrue( isVerfiedR236, 236, @"[In PidTagAttachDataBinary Property] The PidTagAttachDataBinary property ([MS-OXPROPS] section 2.580) contains the contents of the file to be attached."); if (Convert.ToInt32(pidTagAttachMethod.Value) == 0x00000001) { // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R590"); // Verify MS-OXCMSG requirement: MS-OXCMSG_R590 this.Site.CaptureRequirementIfIsNotNull( pidTagAttachDataBinary.Value, 590, @"[In PidTagAttachMethod Property] [afByValue (0x00000001)] The PidTagAttachDataBinary property (section 2.2.2.7) contains the attachment data."); } if(Common.IsRequirementEnabled(3008,this.Site)) { PropertyObj pidTagObjectType = PropertyHelper.GetPropertyByName(ps, PropertyNames.PidTagObjectType); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R3008"); // Verify MS-OXCMSG requirement: MS-OXCMSG_R3008 this.Site.CaptureRequirementIfIsNotNull( pidTagObjectType.Value, 3008, @"[In Appendix A: Product Behavior] Implementation does support the PidTagObjectType property. (Exchange 2007 follows this behavior.)"); } #endregion #region Call RopRelease to release the created message and the created attachment this.ReleaseRop(attachmentHandle); this.ReleaseRop(targetMessageHandle); #endregion }
public void MSOXCMSG_S04_TC01_GeneralPropertiesOnMessageObject() { this.CheckMapiHttpIsSupported(); this.ConnectToServer(ConnectionType.PrivateMailboxServer); #region Call RopLogon to logon the private mailbox. RopLogonResponse logonResponse = this.Logon(LogonType.Mailbox, out this.insideObjHandle); #endregion #region Call RopOpenFolder to open inbox folder. uint folderHandle = this.OpenSpecificFolder(logonResponse.FolderIds[4], this.insideObjHandle); #endregion #region Call RopCreateMessage to create Message object. uint targetMessageHandle = this.CreatedMessage(logonResponse.FolderIds[4], this.insideObjHandle); #endregion #region Call RopModifyRecipients to add recipient to message created by step2 PropertyTag[] recipientColumns = this.CreateRecipientColumns(); List<ModifyRecipientRow> modifyRecipientRow = new List<ModifyRecipientRow> { this.CreateModifyRecipientRow(Common.GetConfigurationPropertyValue("AdminUserName", this.Site), 0) }; this.AddRecipients(modifyRecipientRow, targetMessageHandle, recipientColumns); #endregion #region Call RopGetPropertiesSpecific to get PidTagMessageFlags property for created message before save message. // Prepare property Tag PropertyTag[] tagArray = new PropertyTag[1]; tagArray[0] = PropertyHelper.PropertyTagDic[PropertyNames.PidTagMessageFlags]; // Get properties for Created Message RopGetPropertiesSpecificRequest getPropertiesSpecificRequest = new RopGetPropertiesSpecificRequest() { RopId = (byte)RopId.RopGetPropertiesSpecific, LogonId = CommonLogonId, // The logonId 0x00 is associated with this operation. InputHandleIndex = CommonInputHandleIndex, // This index specifies the location 0x00 in the Server Object Handle Table where the handle for the input Server Object is stored. PropertySizeLimit = 0xFFFF, // This value specifies the maximum number of the property PropertyTagCount = (ushort)tagArray.Length, PropertyTags = tagArray }; this.ResponseSOHs = this.MSOXCMSGAdapter.DoRopCall(getPropertiesSpecificRequest, targetMessageHandle, ref this.response, ref this.rawData, GetPropertiesFlags.None); RopGetPropertiesSpecificResponse getPropertiesSpecificResponse = (RopGetPropertiesSpecificResponse)this.response; Site.Assert.AreEqual<uint>(TestSuiteBase.Success, getPropertiesSpecificResponse.ReturnValue, TestSuiteBase.ROPSucceedMsg); List<PropertyObj> ps = PropertyHelper.GetPropertyObjFromBuffer(tagArray, getPropertiesSpecificResponse); PropertyObj pidTagMessageFlags = PropertyHelper.GetPropertyByName(ps, PropertyNames.PidTagMessageFlags); #endregion #region Call RopSetProperties to set PidTagMessageFlags property of created message. List<PropertyObj> propertyList = this.SetGeneralPropertiesOfMessage(); int messageFlags = Convert.ToInt32(pidTagMessageFlags.Value) | (int)MessageFlags.MfResend; propertyList.Add(new PropertyObj(PropertyNames.PidTagMessageFlags, BitConverter.GetBytes(messageFlags))); this.SetPropertiesForMessage(targetMessageHandle, propertyList); #endregion #region Call RopSaveChangesMessage to save created message. RopSaveChangesMessageResponse saveChangesMessageResponse = this.SaveMessage(targetMessageHandle, (byte)SaveFlags.ForceSave); // The message ID of specific message created by above step. ulong messageId = saveChangesMessageResponse.MessageId; #endregion #region Call RopGetContentsTable to get the contents table of inbox folder before submit message. RopGetContentsTableResponse getContentsTableResponse = this.GetContentTableSuccess(folderHandle); uint contentTableHandle = this.ResponseSOHs[0][getContentsTableResponse.OutputHandleIndex]; uint rowCountBeforeSubmit = getContentsTableResponse.RowCount; this.ReleaseRop(contentTableHandle); #endregion #region Call RopSubmitMessage to submit message RopSubmitMessageRequest submitMessageRequest = new RopSubmitMessageRequest() { RopId = (byte)RopId.RopSubmitMessage, LogonId = CommonLogonId, InputHandleIndex = CommonInputHandleIndex, SubmitFlags = (byte)SubmitFlags.None }; this.ResponseSOHs = this.MSOXCMSGAdapter.DoRopCall(submitMessageRequest, targetMessageHandle, ref this.response, ref this.rawData, GetPropertiesFlags.None); RopSubmitMessageResponse submitMessageResponse = (RopSubmitMessageResponse)this.response; Site.Assert.AreEqual<uint>(TestSuiteBase.Success, submitMessageResponse.ReturnValue, "Call RopSubmitMessage should success."); #endregion #region Call RopOpenMessage to open created message. RopOpenMessageRequest openMessageRequest = new RopOpenMessageRequest { RopId = (byte)RopId.RopOpenMessage, LogonId = CommonLogonId, InputHandleIndex = CommonInputHandleIndex, OutputHandleIndex = CommonOutputHandleIndex, CodePageId = 0x0FFF, FolderId = logonResponse.FolderIds[4], OpenModeFlags = (byte)MessageOpenModeFlags.ReadOnly, MessageId = messageId }; this.ResponseSOHs = this.MSOXCMSGAdapter.DoRopCall(openMessageRequest, this.insideObjHandle, ref this.response, ref this.rawData, GetPropertiesFlags.None); RopOpenMessageResponse openMessageResponse = (RopOpenMessageResponse)this.response; Site.Assert.AreEqual<uint>(TestSuiteBase.Success, openMessageResponse.ReturnValue, "Call RopOpenMessage should success."); targetMessageHandle = this.ResponseSOHs[0][openMessageResponse.OutputHandleIndex]; #region Verify MS-OXCMSG_R676, MS-OXCMSG_R678 and MS-OXCMSG_R1298 string subjectPrefixInOpenResponse = System.Text.ASCIIEncoding.ASCII.GetString(openMessageResponse.SubjectPrefix.String); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R676"); // Verify MS-OXCMSG requirement: MS-OXCMSG_R676 this.Site.CaptureRequirementIfAreEqual<string>( TestDataOfPidTagSubjectPrefix, subjectPrefixInOpenResponse.Substring(0, subjectPrefixInOpenResponse.Length - 1), 676, @"[In RopOpenMessage ROP Response Buffer] [SubjectPrefix] The SubjectPrefix field contains the value of the PidTagSubjectPrefix property (section 2.2.1.9)."); string normalizedSubjectInOpenResponse = System.Text.ASCIIEncoding.ASCII.GetString(openMessageResponse.NormalizedSubject.String); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R678"); // Verify MS-OXCMSG requirement: MS-OXCMSG_R678 this.Site.CaptureRequirementIfAreEqual<string>( TestSuiteBase.TestDataOfPidTagNormalizedSubject, normalizedSubjectInOpenResponse.Substring(0, normalizedSubjectInOpenResponse.Length - 1), 678, @"[In RopOpenMessage ROP Response Buffer] [NormalizedSubject] The NormalizedSubject field contains the value of the PidTagNormalizedSubject property (section 2.2.1.10)."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R1298"); // Verify MS-OXCMSG requirement: MS-OXCMSG_R1298 this.Site.CaptureRequirementIfAreEqual<int>( 0x10, openMessageResponse.RecipientRows[0].RecipientType, 1298, @"[In RopOpenMessage ROP Response Buffer] [RecipientRows] The value 0x10 means when resending a previous failure, this flag indicates that this recipient (1) did not successfully receive the message on the previous attempt."); #endregion #endregion #region Call RopGetPropertiesAll to get all properties of created message. RopGetPropertiesAllRequest getPropertiesAllRequest = new RopGetPropertiesAllRequest() { RopId = (byte)RopId.RopGetPropertiesAll, LogonId = CommonLogonId, InputHandleIndex = CommonInputHandleIndex, // Set PropertySizeLimit,which specifies the maximum size allowed for a property value returned, // as specified in [MS-OXCROPS] section 2.2.8.4.1. PropertySizeLimit = 0xFFFF, WantUnicode = 1, }; // In process, call capture code to verify adapter requirement this.ResponseSOHs = this.MSOXCMSGAdapter.DoRopCall(getPropertiesAllRequest, targetMessageHandle, ref this.response, ref this.rawData, GetPropertiesFlags.MessageProperties); RopGetPropertiesAllResponse getPropertiesAllResponse = (RopGetPropertiesAllResponse)this.response; Site.Assert.AreEqual<uint>(TestSuiteBase.Success, getPropertiesAllResponse.ReturnValue, "Call RopGetPropertiesAll should success."); List<PropertyObj> propertyValues = PropertyHelper.GetPropertyObjFromBuffer(getPropertiesAllResponse); PropertyObj pidTagImportance = PropertyHelper.GetPropertyByName(propertyValues, PropertyNames.PidTagImportance); PropertyObj pidTagPriority = PropertyHelper.GetPropertyByName(propertyValues, PropertyNames.PidTagPriority); PropertyObj pidTagSensitivity = PropertyHelper.GetPropertyByName(propertyValues, PropertyNames.PidTagSensitivity); PropertyObj pidTagTrustSender = PropertyHelper.GetPropertyByName(propertyValues, PropertyNames.PidTagTrustSender); PropertyObj pidTagSubject = PropertyHelper.GetPropertyByName(propertyValues, PropertyNames.PidTagSubject); PropertyObj pidTagSubjectPrefix = PropertyHelper.GetPropertyByName(propertyValues, PropertyNames.PidTagSubjectPrefix); PropertyObj pidTagNormalizedSubject = PropertyHelper.GetPropertyByName(propertyValues, PropertyNames.PidTagNormalizedSubject); #region Verify requirements // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R1668 ,the property count is {0}.", getPropertiesAllResponse.PropertyValueCount); // Verify MS-OXCMSG requirement: MS-OXCMSG_R1668 bool isVerifiedR1668 = getPropertiesAllResponse.PropertyValueCount > 0; this.Site.CaptureRequirementIfIsTrue( isVerifiedR1668, 1668, @"[In RopOpenMessage ROP Response Buffer] [HasNamedProperties] Nonzero: Named properties are defined for this Message object and can be obtained through a RopGetPropertiesAll ROP request ([MS-OXCROPS] section 2.2.8.4)."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R72"); // Verify MS-OXCMSG requirement: MS-OXCMSG_R72 this.Site.CaptureRequirementIfAreEqual<int>( 0x00000000, Convert.ToInt32(pidTagImportance.Value), 72, @"[In PidTagImportance Property] [The value 0x00000000 indicates the level of importance assigned by the end user to the Message object is] Low importance."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R80"); // Verify MS-OXCMSG requirement: MS-OXCMSG_R80 this.Site.CaptureRequirementIfAreEqual<int>( -1, Convert.ToInt32(pidTagPriority.Value), 80, @"[In PidTagPriority Property] [The value 0xFFFFFFFF indicates the client's request for the priority is] Not urgent."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R86"); // Verify MS-OXCMSG requirement: MS-OXCMSG_R86 this.Site.CaptureRequirementIfAreEqual<int>( 0x00000001, Convert.ToInt32(pidTagSensitivity.Value), 86, @"[In PidTagSensitivity Property] [The value 0x00000001 indicates the sender's assessment of the sensitivity of the Message object is] Personal."); if (Common.IsRequirementEnabled(1713, this.Site)) { // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R1236"); // Verify MS-OXCMSG requirement: MS-OXCMSG_R1236 this.Site.CaptureRequirementIfAreEqual<int>( 0x00000001, (int)pidTagTrustSender.Value, 1236, @"[In PidTagTrustSender] The value 0x00000001 indicates that the message was delivered through a trusted transport channel."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R1713"); // Verify MS-OXCMSG requirement: MS-OXCMSG_R1713 this.Site.CaptureRequirementIfIsNotNull( pidTagTrustSender.Value, 1713, @"[In Appendix A: Product Behavior] Implementation does support the PidTagTrustSender property. (Exchange 2007 follows this behavior.)"); } PropertyObj pidTagPurportedSenderDomain = PropertyHelper.GetPropertyByName(propertyValues, PropertyNames.PidTagPurportedSenderDomain); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R1214"); // Verify MS-OXCMSG requirement: MS-OXCMSG_R1214 this.Site.CaptureRequirementIfAreEqual<string>( Common.GetConfigurationPropertyValue("Domain", this.Site), pidTagPurportedSenderDomain.Value.ToString(), 1214, @"[In PidTagPurportedSenderDomain Property] The PidTagPurportedSenderDomain property ([MS-OXPROPS] section 2.865) contains the domain name of the last sender responsible for transmitting the current message."); PropertyObj pidTagAlternateRecipientAllowed = PropertyHelper.GetPropertyByName(propertyValues, PropertyNames.PidTagAlternateRecipientAllowed); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R1797"); // Verify MS-OXCMSG requirement: MS-OXCMSG_R1797 this.Site.CaptureRequirementIfIsTrue( Convert.ToBoolean(pidTagAlternateRecipientAllowed.Value), 1797, @"[In PidTagAlternateRecipientAllowed Property] This property [PidTagAlternateRecipientAllowed] is set to ""TRUE"" if autoforwarding is allowed."); PropertyObj pidTagResponsibility = PropertyHelper.GetPropertyByName(propertyValues, PropertyNames.PidTagResponsibility); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R1198"); // Verify MS-OXCMSG requirement: MS-OXCMSG_R1198 this.Site.CaptureRequirementIfIsTrue( Convert.ToBoolean(pidTagResponsibility.Value), 1198, @"[In PidTagResponsibility Property] This property [PidTagResponsibility] is set to ""TRUE"" if another agent has accepted responsibility."); pidTagMessageFlags = PropertyHelper.GetPropertyByName(propertyValues, PropertyNames.PidTagMessageFlags); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R515"); // Verify MS-OXCMSG requirement: MS-OXCMSG_R515 this.Site.CaptureRequirementIfAreEqual<int>( 0x00000080, Convert.ToInt32(pidTagMessageFlags.Value) & 0x00000080, 515, @"[In PidTagMessageFlags Property] [mfResend (0x00000080)] The message includes a request for a resend operation with a non-delivery report."); #endregion #endregion #region Call RopGetPropertiesSpecific to get the specific properties of created message. List<PropertyTag> propertiesOfMessage = this.GetPropertyTagListOfMessageObject(); propertyValues = this.GetSpecificPropertiesOfMessage(logonResponse.FolderIds[4], messageId, this.insideObjHandle, propertiesOfMessage); // Parse property response get Property Value to verify test case requirement pidTagImportance = PropertyHelper.GetPropertyByName(propertyValues, PropertyNames.PidTagImportance); pidTagSubjectPrefix = PropertyHelper.GetPropertyByName(propertyValues, PropertyNames.PidTagSubjectPrefix); pidTagNormalizedSubject = PropertyHelper.GetPropertyByName(propertyValues, PropertyNames.PidTagNormalizedSubject); pidTagSubject = PropertyHelper.GetPropertyByName(propertyValues, PropertyNames.PidTagSubject); PropertyObj pidTagRecipientDisplayName = PropertyHelper.GetPropertyByName(propertyValues, PropertyNames.PidTagRecipientDisplayName); #region Verify requirements // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R58"); // Verify MS-OXCMSG requirement: MS-OXCMSG_R58 this.Site.CaptureRequirementIfAreEqual<string>( TestDataOfPidTagSubjectPrefix, pidTagSubjectPrefix.Value.ToString(), 58, @"[In PidTagSubjectPrefix Property] The PidTagSubjectPrefix property ([MS-OXPROPS] section 2.1096) contains the prefix for the subject of the message."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R64"); // Verify MS-OXCMSG requirement: MS-OXCMSG_R64 this.Site.CaptureRequirementIfAreEqual<string>( TestSuiteBase.TestDataOfPidTagNormalizedSubject, pidTagNormalizedSubject.Value.ToString(), 64, @"[In PidTagNormalizedSubject Property] The PidTagNormalizedSubject property ([MS-OXPROPS] section 2.877) contains the normalized subject of the message, as specified in [MS-OXCMAIL] section 2.2.3.2.6.1."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R1238"); string mailSubject = TestDataOfPidTagSubjectPrefix + TestDataOfPidTagNormalizedSubject; // Verify MS-OXCMSG requirement: MS-OXCMSG_R1238 this.Site.CaptureRequirementIfAreEqual<string>( mailSubject, pidTagSubject.Value.ToString(), 1238, @"[In PidTagSubject Property] The PidTagSubject property ([MS-OXPROPS] section 2.1021) contains the full subject of an e-mail message."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R1239"); // Verify MS-OXCMSG requirement: MS-OXCMSG_R1239 this.Site.CaptureRequirementIfAreEqual<string>( mailSubject, pidTagSubject.Value.ToString(), 1239, @"[In PidTagSubject Property] The full subject is a concatenation of the subject prefix, as identified by the PidTagSubjectPrefix property (section 2.2.1.9), and the normalized subject, as identified by the PidTagNormalizedSubject property (section 2.2.1.10)."); PropertyObj pidTagAutoForwarded = PropertyHelper.GetPropertyByName(propertyValues, PropertyNames.PidTagAutoForwarded); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R1108"); // Verify MS-OXCMSG requirement: MS-OXCMSG_R1108 this.Site.CaptureRequirementIfAreEqual<byte>( 0x00, Convert.ToByte(pidTagAutoForwarded.Value), 1108, @"[In PidTagAutoForwarded Property] If this property [PidTagAutoForwarded] is unset, a default value of 0x00 is assumed."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R2047"); // Verify MS-OXCMSG requirement: MS-OXCMSG_R2047 this.Site.CaptureRequirementIfAreEqual<string>( Common.GetConfigurationPropertyValue("AdminUserName", this.Site), pidTagRecipientDisplayName.Value.ToString(), 2047, @"[In PidTagRecipientDisplayName Property] The PidTagRecipientDisplayName property ([MS-OXPROPS] section 2.888) specifies the display name of a recipient (2)."); #endregion #endregion #region Receive the message sent by step 9. bool isMessageReceived = WaitEmailBeDelivered(folderHandle, rowCountBeforeSubmit); Site.Assert.IsTrue(isMessageReceived, "The message should be received."); #endregion #region Call RopRelease to release all resources. this.ReleaseRop(targetMessageHandle); this.ReleaseRop(folderHandle); #endregion }
public void MSOXCMSG_S04_TC05_PidTagRetentionFlagsProperty() { this.CheckMapiHttpIsSupported(); this.ConnectToServer(ConnectionType.PrivateMailboxServer); #region Call RopLogon to logon the private mailbox. RopLogonResponse logonResponse = this.Logon(LogonType.Mailbox, out this.insideObjHandle); #endregion #region Call RopCreateMessage to create a Message object. uint targetMessageHandle = this.CreatedMessage(logonResponse.FolderIds[4], this.insideObjHandle); #endregion #region Call SetPropertiesSpecific to set PidTagRetentionFlags property to ExplicitTag. List<PropertyObj> propertyList = new List<PropertyObj> { new PropertyObj(PropertyNames.PidTagRetentionFlags, BitConverter.GetBytes(0x00000001)) }; this.SetPropertiesForMessage(targetMessageHandle, propertyList); #endregion #region Call RopSaveChangesMessage to save created message. RopSaveChangesMessageResponse saveChangesMessageResponse = this.SaveMessage(targetMessageHandle, (byte)SaveFlags.ForceSave); Site.Assert.AreEqual<uint>(TestSuiteBase.Success, saveChangesMessageResponse.ReturnValue, TestSuiteBase.ROPSucceedMsg); #endregion #region Call RopGetPropertiesAll to get all properties of created message. RopGetPropertiesAllRequest getPropertiesAllRequest = new RopGetPropertiesAllRequest() { RopId = (byte)RopId.RopGetPropertiesAll, LogonId = CommonLogonId, InputHandleIndex = CommonInputHandleIndex, // Set PropertySizeLimit,which specifies the maximum size allowed for a property value returned, // as specified in [MS-OXCROPS] section 2.2.8.4.1. PropertySizeLimit = 0xFFFF, WantUnicode = 1 }; // In process, call capture code to verify adapter requirement this.ResponseSOHs = this.MSOXCMSGAdapter.DoRopCall(getPropertiesAllRequest, targetMessageHandle, ref this.response, ref this.rawData, GetPropertiesFlags.MessageProperties); RopGetPropertiesAllResponse getPropertiesAllResponse = (RopGetPropertiesAllResponse)this.response; Site.Assert.AreEqual<uint>(TestSuiteBase.Success, getPropertiesAllResponse.ReturnValue, "Call RopGetProperties should success."); List<PropertyObj> propertyValues = PropertyHelper.GetPropertyObjFromBuffer(getPropertiesAllResponse); PropertyObj pidTagRetentionFlags = PropertyHelper.GetPropertyByName(propertyValues, PropertyNames.PidTagRetentionFlags); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R945"); // Verify MS-OXCMSG requirement: MS-OXCMSG_R945 this.Site.CaptureRequirementIfAreEqual<int>( Convert.ToInt32(pidTagRetentionFlags.Value), 0x00000001, 2154, @"[In PidTagRetentionFlags Property] [ExplicitTag (0x00000001)] The retention tag on the folder is explicitly set."); #endregion #region Call SetPropertiesSpecific to set PidTagRetentionFlags property to UserOverride. propertyList = new List<PropertyObj> { new PropertyObj(PropertyNames.PidTagRetentionFlags, BitConverter.GetBytes(0x00000002)) }; this.SetPropertiesForMessage(targetMessageHandle, propertyList); #endregion #region Call RopSaveChangesMessage to save created message. saveChangesMessageResponse = this.SaveMessage(targetMessageHandle, (byte)SaveFlags.ForceSave); Site.Assert.AreEqual<uint>(TestSuiteBase.Success, saveChangesMessageResponse.ReturnValue, TestSuiteBase.ROPSucceedMsg); #endregion #region Call RopGetPropertiesAll to get all properties of created message. this.ResponseSOHs = this.MSOXCMSGAdapter.DoRopCall(getPropertiesAllRequest, targetMessageHandle, ref this.response, ref this.rawData, GetPropertiesFlags.MessageProperties); getPropertiesAllResponse = (RopGetPropertiesAllResponse)this.response; Site.Assert.AreEqual<uint>(TestSuiteBase.Success, getPropertiesAllResponse.ReturnValue, "Call RopGetProperties should success."); propertyValues = PropertyHelper.GetPropertyObjFromBuffer(getPropertiesAllResponse); pidTagRetentionFlags = PropertyHelper.GetPropertyByName(propertyValues, PropertyNames.PidTagRetentionFlags); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R946"); // Verify MS-OXCMSG requirement: MS-OXCMSG_R946 this.Site.CaptureRequirementIfAreEqual<int>( 0x00000002, Convert.ToInt32(pidTagRetentionFlags.Value), 2155, @"[In PidTagRetentionFlags Property] [UserOverride (0x00000002)] The retention tag was not changed by the end user."); #endregion #region Call SetPropertiesSpecific to set PidTagRetentionFlags property to AutoTag. propertyList = new List<PropertyObj> { new PropertyObj(PropertyNames.PidTagRetentionFlags, BitConverter.GetBytes(0x00000004)) }; this.SetPropertiesForMessage(targetMessageHandle, propertyList); #endregion #region Call RopSaveChangesMessage to save created message. saveChangesMessageResponse = this.SaveMessage(targetMessageHandle, (byte)SaveFlags.ForceSave); Site.Assert.AreEqual<uint>(TestSuiteBase.Success, saveChangesMessageResponse.ReturnValue, TestSuiteBase.ROPSucceedMsg); #endregion #region Call RopGetPropertiesAll to get all properties of created message. this.ResponseSOHs = this.MSOXCMSGAdapter.DoRopCall(getPropertiesAllRequest, targetMessageHandle, ref this.response, ref this.rawData, GetPropertiesFlags.MessageProperties); getPropertiesAllResponse = (RopGetPropertiesAllResponse)this.response; Site.Assert.AreEqual<uint>(TestSuiteBase.Success, getPropertiesAllResponse.ReturnValue, "Call RopGetProperties should success."); propertyValues = PropertyHelper.GetPropertyObjFromBuffer(getPropertiesAllResponse); pidTagRetentionFlags = PropertyHelper.GetPropertyByName(propertyValues, PropertyNames.PidTagRetentionFlags); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R947"); // Verify MS-OXCMSG requirement: MS-OXCMSG_R947 this.Site.CaptureRequirementIfAreEqual<int>( 0x00000004, Convert.ToInt32(pidTagRetentionFlags.Value), 2156, @"[In PidTagRetentionFlags Property] [AutoTag (0x00000004)] The retention tag on the Message object is an autotag, which is predicted by the system."); #endregion #region Call SetPropertiesSpecific to set PidTagRetentionFlags property to PersonalTag. propertyList = new List<PropertyObj> { new PropertyObj(PropertyNames.PidTagRetentionFlags, BitConverter.GetBytes(0x00000008)) }; this.SetPropertiesForMessage(targetMessageHandle, propertyList); #endregion #region Call RopSaveChangesMessage to save created message. saveChangesMessageResponse = this.SaveMessage(targetMessageHandle, (byte)SaveFlags.ForceSave); Site.Assert.AreEqual<uint>(TestSuiteBase.Success, saveChangesMessageResponse.ReturnValue, TestSuiteBase.ROPSucceedMsg); #endregion #region Call RopGetPropertiesAll to get all properties of created message. this.ResponseSOHs = this.MSOXCMSGAdapter.DoRopCall(getPropertiesAllRequest, targetMessageHandle, ref this.response, ref this.rawData, GetPropertiesFlags.MessageProperties); getPropertiesAllResponse = (RopGetPropertiesAllResponse)this.response; Site.Assert.AreEqual<uint>(TestSuiteBase.Success, getPropertiesAllResponse.ReturnValue, "Call RopGetProperties should success."); propertyValues = PropertyHelper.GetPropertyObjFromBuffer(getPropertiesAllResponse); pidTagRetentionFlags = PropertyHelper.GetPropertyByName(propertyValues, PropertyNames.PidTagRetentionFlags); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R948"); // Verify MS-OXCMSG requirement: MS-OXCMSG_R948 this.Site.CaptureRequirementIfAreEqual<int>( 0x00000008, Convert.ToInt32(pidTagRetentionFlags.Value), 2157, @"[In PidTagRetentionFlags Property] [PersonalTag (0x00000008)] The retention tag on the folder is of a personal type and can be made available to the end user."); #endregion #region Call SetPropertiesSpecific to set PidTagRetentionFlags property to ExplicitArchiveTag. propertyList = new List<PropertyObj> { new PropertyObj(PropertyNames.PidTagRetentionFlags, BitConverter.GetBytes(0x00000010)) }; this.SetPropertiesForMessage(targetMessageHandle, propertyList); #endregion #region Call RopSaveChangesMessage to save created message. saveChangesMessageResponse = this.SaveMessage(targetMessageHandle, (byte)SaveFlags.ForceSave); Site.Assert.AreEqual<uint>(TestSuiteBase.Success, saveChangesMessageResponse.ReturnValue, TestSuiteBase.ROPSucceedMsg); #endregion #region Call RopGetPropertiesAll to get all properties of created message. this.ResponseSOHs = this.MSOXCMSGAdapter.DoRopCall(getPropertiesAllRequest, targetMessageHandle, ref this.response, ref this.rawData, GetPropertiesFlags.MessageProperties); getPropertiesAllResponse = (RopGetPropertiesAllResponse)this.response; Site.Assert.AreEqual<uint>(TestSuiteBase.Success, getPropertiesAllResponse.ReturnValue, "Call RopGetProperties should success."); propertyValues = PropertyHelper.GetPropertyObjFromBuffer(getPropertiesAllResponse); pidTagRetentionFlags = PropertyHelper.GetPropertyByName(propertyValues, PropertyNames.PidTagRetentionFlags); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R949"); // Verify MS-OXCMSG requirement: MS-OXCMSG_R949 this.Site.CaptureRequirementIfAreEqual<int>( 0x00000010, Convert.ToInt32(pidTagRetentionFlags.Value), 2158, @"[In PidTagRetentionFlags Property] [ExplicitArchiveTag (0x00000010)] The archive tag on the folder is explicitly set."); #endregion #region Call SetPropertiesSpecific to set PidTagRetentionFlags property to KeepInPlace. propertyList = new List<PropertyObj> { new PropertyObj(PropertyNames.PidTagRetentionFlags, BitConverter.GetBytes(0x00000020)) }; this.SetPropertiesForMessage(targetMessageHandle, propertyList); #endregion #region Call RopSaveChangesMessage to save created message. saveChangesMessageResponse = this.SaveMessage(targetMessageHandle, (byte)SaveFlags.ForceSave); Site.Assert.AreEqual<uint>(TestSuiteBase.Success, saveChangesMessageResponse.ReturnValue, TestSuiteBase.ROPSucceedMsg); #endregion #region Call RopGetPropertiesAll to get all properties of created message. this.ResponseSOHs = this.MSOXCMSGAdapter.DoRopCall(getPropertiesAllRequest, targetMessageHandle, ref this.response, ref this.rawData, GetPropertiesFlags.MessageProperties); getPropertiesAllResponse = (RopGetPropertiesAllResponse)this.response; Site.Assert.AreEqual<uint>(TestSuiteBase.Success, getPropertiesAllResponse.ReturnValue, "Call RopGetProperties should success."); propertyValues = PropertyHelper.GetPropertyObjFromBuffer(getPropertiesAllResponse); pidTagRetentionFlags = PropertyHelper.GetPropertyByName(propertyValues, PropertyNames.PidTagRetentionFlags); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R950"); // Verify MS-OXCMSG requirement: MS-OXCMSG_R950 this.Site.CaptureRequirementIfAreEqual<int>( 0x00000020, Convert.ToInt32(pidTagRetentionFlags.Value), 2159, @"[In PidTagRetentionFlags Property] [KeepInPlace (0x00000020)] The Message object remains in place and is not archived."); #endregion #region Call SetPropertiesSpecific to set PidTagRetentionFlags property to SystemData. propertyList = new List<PropertyObj> { new PropertyObj(PropertyNames.PidTagRetentionFlags, BitConverter.GetBytes(0x00000040)) }; this.SetPropertiesForMessage(targetMessageHandle, propertyList); #endregion #region Call RopSaveChangesMessage to save created message. saveChangesMessageResponse = this.SaveMessage(targetMessageHandle, (byte)SaveFlags.ForceSave); Site.Assert.AreEqual<uint>(TestSuiteBase.Success, saveChangesMessageResponse.ReturnValue, TestSuiteBase.ROPSucceedMsg); #endregion #region Call RopGetPropertiesAll to get all properties of created message. this.ResponseSOHs = this.MSOXCMSGAdapter.DoRopCall(getPropertiesAllRequest, targetMessageHandle, ref this.response, ref this.rawData, GetPropertiesFlags.MessageProperties); getPropertiesAllResponse = (RopGetPropertiesAllResponse)this.response; Site.Assert.AreEqual<uint>(TestSuiteBase.Success, getPropertiesAllResponse.ReturnValue, "Call RopGetProperties should success."); propertyValues = PropertyHelper.GetPropertyObjFromBuffer(getPropertiesAllResponse); pidTagRetentionFlags = PropertyHelper.GetPropertyByName(propertyValues, PropertyNames.PidTagRetentionFlags); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R951"); // Verify MS-OXCMSG requirement: MS-OXCMSG_R951 this.Site.CaptureRequirementIfAreEqual<int>( 0x00000040, Convert.ToInt32(pidTagRetentionFlags.Value), 2160, @"[In PidTagRetentionFlags Property] [SystemData (0x00000040)] The Message object or folder is system data."); #endregion if (Common.IsRequirementEnabled(1909, this.Site)) { #region Call SetPropertiesSpecific to set PidTagRetentionFlags property to NeedsRescan. propertyList = new List<PropertyObj> { new PropertyObj(PropertyNames.PidTagRetentionFlags, BitConverter.GetBytes(0x00000080)) }; this.SetPropertiesForMessage(targetMessageHandle, propertyList); #endregion #region Call RopSaveChangesMessage to save created message. saveChangesMessageResponse = this.SaveMessage(targetMessageHandle, (byte)SaveFlags.ForceSave); Site.Assert.AreEqual<uint>(TestSuiteBase.Success, saveChangesMessageResponse.ReturnValue, TestSuiteBase.ROPSucceedMsg); #endregion #region Call RopGetPropertiesAll to get all properties of created message. this.ResponseSOHs = this.MSOXCMSGAdapter.DoRopCall(getPropertiesAllRequest, targetMessageHandle, ref this.response, ref this.rawData, GetPropertiesFlags.MessageProperties); getPropertiesAllResponse = (RopGetPropertiesAllResponse)this.response; Site.Assert.AreEqual<uint>(TestSuiteBase.Success, getPropertiesAllResponse.ReturnValue, "Call RopGetProperties should success."); propertyValues = PropertyHelper.GetPropertyObjFromBuffer(getPropertiesAllResponse); pidTagRetentionFlags = PropertyHelper.GetPropertyByName(propertyValues, PropertyNames.PidTagRetentionFlags); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R1909"); // Verify MS-OXCMSG requirement: MS-OXCMSG_R1909 this.Site.CaptureRequirementIfAreEqual<int>( 0x00000080, Convert.ToInt32(pidTagRetentionFlags.Value), 1909, @"[In Appendix A: Product Behavior] Implementation does support the NeedsRescan flag. (Exchange 2010 SP2 and above follows this behavior.)"); #endregion } if (Common.IsRequirementEnabled(1911, this.Site)) { #region Call SetPropertiesSpecific to set PidTagRetentionFlags property to PendingRescan. propertyList = new List<PropertyObj> { new PropertyObj(PropertyNames.PidTagRetentionFlags, BitConverter.GetBytes(0x00000100)) }; this.SetPropertiesForMessage(targetMessageHandle, propertyList); #endregion #region Call RopSaveChangesMessage to save created message. saveChangesMessageResponse = this.SaveMessage(targetMessageHandle, (byte)SaveFlags.ForceSave); Site.Assert.AreEqual<uint>(TestSuiteBase.Success, saveChangesMessageResponse.ReturnValue, TestSuiteBase.ROPSucceedMsg); #endregion #region Call RopGetPropertiesAll to get all properties of created message. this.ResponseSOHs = this.MSOXCMSGAdapter.DoRopCall(getPropertiesAllRequest, targetMessageHandle, ref this.response, ref this.rawData, GetPropertiesFlags.MessageProperties); getPropertiesAllResponse = (RopGetPropertiesAllResponse)this.response; Site.Assert.AreEqual<uint>(TestSuiteBase.Success, getPropertiesAllResponse.ReturnValue, "Call RopGetProperties should success."); propertyValues = PropertyHelper.GetPropertyObjFromBuffer(getPropertiesAllResponse); pidTagRetentionFlags = PropertyHelper.GetPropertyByName(propertyValues, PropertyNames.PidTagRetentionFlags); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R1911"); // Verify MS-OXCMSG requirement: MS-OXCMSG_R1911 this.Site.CaptureRequirementIfAreEqual<int>( 0x00000100, Convert.ToInt32(pidTagRetentionFlags.Value), 1911, @"[In Appendix A: Product Behavior] Implementation does support the PendingRescan flag. (Exchange 2010 SP2 and above follow this behavior.)"); #endregion } #region Call RopRelease to release the created message. this.ReleaseRop(targetMessageHandle); #endregion }
public void MSOXCMSG_S04_TC04_RetentionAndArchivePropertiesOnFolder() { this.CheckMapiHttpIsSupported(); this.ConnectToServer(ConnectionType.PrivateMailboxServer); RopLogonResponse logonResponse = this.Logon(LogonType.Mailbox, out this.insideObjHandle); #region Call RopOpenFolder to open an existing folder uint openedFolderHandle = this.OpenSpecificFolder(logonResponse.FolderIds[4], this.insideObjHandle); #endregion #region Call RopCreateFolder to create a new folder. ulong folderId; this.CreateSubFolder(openedFolderHandle, out folderId); #endregion #region Call RopOpenFolder to open a folder create by above step. uint openSubfolderHandle = this.OpenSpecificFolder(folderId, this.insideObjHandle); #endregion #region Call RopSetProperties to set properties of retention and archive. List<PropertyObj> propertyList = new List<PropertyObj> { new PropertyObj(PropertyNames.PidTagArchiveTag, PropertyHelper.GetBinaryFromGeneral(Guid.NewGuid().ToByteArray())), new PropertyObj(PropertyNames.PidTagPolicyTag, PropertyHelper.GetBinaryFromGeneral(Guid.NewGuid().ToByteArray())), new PropertyObj(PropertyNames.PidTagRetentionPeriod, BitConverter.GetBytes(0x00000001)) }; List<byte> lstBytes = new List<byte>(); lstBytes.AddRange(BitConverter.GetBytes(0x00000001)); lstBytes.AddRange(BitConverter.GetBytes(DateTime.Parse(TestDataOfDateTime).ToFileTimeUtc())); propertyList.Add(new PropertyObj(PropertyNames.PidTagStartDateEtc, PropertyHelper.GetBinaryFromGeneral(lstBytes.ToArray()))); propertyList.Add(new PropertyObj(PropertyNames.PidTagRetentionDate, BitConverter.GetBytes(DateTime.Parse(TestDataOfDateTime).ToFileTimeUtc()))); propertyList.Add(new PropertyObj(PropertyNames.PidTagRetentionFlags, BitConverter.GetBytes(0x00000002))); propertyList.Add(new PropertyObj(PropertyNames.PidTagArchivePeriod, BitConverter.GetBytes(0x00000002))); propertyList.Add(new PropertyObj(PropertyNames.PidTagArchiveDate, BitConverter.GetBytes(DateTime.Parse(TestDataOfDateTime).ToFileTimeUtc()))); this.SetPropertiesForMessage(openSubfolderHandle, propertyList); #endregion #region Call RopGetPropertiesAll to get all properties of the created folder. RopGetPropertiesAllRequest getPropertiesAllRequest = new RopGetPropertiesAllRequest() { RopId = (byte)RopId.RopGetPropertiesAll, LogonId = CommonLogonId, InputHandleIndex = CommonInputHandleIndex, // Set PropertySizeLimit,which specifies the maximum size allowed for a property value returned, // as specified in [MS-OXCROPS] section 2.2.8.4.1. PropertySizeLimit = 0xFFFF, WantUnicode = 1 }; // In process, call capture code to verify adapter requirement this.ResponseSOHs = this.MSOXCMSGAdapter.DoRopCall(getPropertiesAllRequest, openSubfolderHandle, ref this.response, ref this.rawData, GetPropertiesFlags.None); RopGetPropertiesAllResponse getPropertiesAllResponse = (RopGetPropertiesAllResponse)this.response; Site.Assert.AreEqual<uint>(TestSuiteBase.Success, getPropertiesAllResponse.ReturnValue, "Call RopGetPropertiesAll should success."); List<PropertyObj> ps = PropertyHelper.GetPropertyObjFromBuffer(getPropertiesAllResponse); #region Verify requirements PropertyObj pidTagArchiveTag = PropertyHelper.GetPropertyByName(ps, PropertyNames.PidTagArchiveTag); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R1818"); // Verify MS-OXCMSG requirement: MS-OXCMSG_R1818 this.Site.CaptureRequirementIfIsNotNull( pidTagArchiveTag, 2195, @"[In PidTagArchiveTag Property] [In PidTagArchiveTag Property] The PidTagArchiveTag property can be present on folders."); PropertyObj pidTagPolicyTag = PropertyHelper.GetPropertyByName(ps, PropertyNames.PidTagPolicyTag); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R1819"); // Verify MS-OXCMSG requirement: MS-OXCMSG_R1819 this.Site.CaptureRequirementIfIsNotNull( pidTagPolicyTag, 2114, @"[In PidTagPolicyTag Property] The PidTagPolicyTag property can be present on folders."); PropertyObj pidTagRetentionPeriod = PropertyHelper.GetPropertyByName(ps, PropertyNames.PidTagRetentionPeriod); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R1820"); // Verify MS-OXCMSG requirement: MS-OXCMSG_R1820 this.Site.CaptureRequirementIfIsNotNull( pidTagRetentionPeriod, 2120, @"[In PidTagRetentionPeriod Property] The PidTagRetentionPeriod property can be present on folders."); PropertyObj pidTagRetentionFlags = PropertyHelper.GetPropertyByName(ps, PropertyNames.PidTagRetentionFlags); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R1822"); // Verify MS-OXCMSG requirement: MS-OXCMSG_R1822 this.Site.CaptureRequirementIfIsNotNull( pidTagRetentionFlags, 2150, @"[In PidTagRetentionFlags Property] The PidTagRetentionFlags property can be present on folders."); PropertyObj pidTagArchivePeriod = PropertyHelper.GetPropertyByName(ps, PropertyNames.PidTagArchivePeriod); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R1823"); // Verify MS-OXCMSG requirement: MS-OXCMSG_R1823 this.Site.CaptureRequirementIfIsNotNull( pidTagArchivePeriod, 2166, @"[In PidTagArchivePeriod Property] The PidTagArchivePeriod property can be present on folders."); #endregion #endregion #region Call RopDeleteFolder to delete the folder created by above step. RopDeleteFolderRequest deleteFolderRequest = new RopDeleteFolderRequest() { RopId = (byte)RopId.RopDeleteFolder, LogonId = CommonLogonId, InputHandleIndex = CommonInputHandleIndex, DeleteFolderFlags = (byte)DeleteFolderFlags.DeleteHardDelete | (byte)DeleteFolderFlags.DelMessages, FolderId = folderId // Folder to be deleted }; this.ResponseSOHs = this.MSOXCMSGAdapter.DoRopCall(deleteFolderRequest, openedFolderHandle, ref this.response, ref this.rawData, GetPropertiesFlags.None); RopDeleteFolderResponse deleteFolderresponse = (RopDeleteFolderResponse)this.response; Site.Assert.AreEqual<uint>(TestSuiteBase.Success, deleteFolderresponse.ReturnValue, "Call RopDeleteFolder should success."); #endregion #region Call RopRelease to release all resources this.ReleaseRop(openSubfolderHandle); this.ReleaseRop(openedFolderHandle); #endregion }
/// <summary> /// Get all properties of a folder object. /// </summary> /// <param name="inputHandle">The handle specified the folder RopGetPropertiesAll Rop operation performs on.</param> /// <param name="responseSOHTable">Server objects handles in RopGetPropertiesSpecificResponse.</param> /// <returns>RopGetPropertiesAllResponse object.</returns> public RopGetPropertiesAllResponse GetFolderPropertiesAll(uint inputHandle, ref List<List<uint>> responseSOHTable) { object ropResponse = new object(); RopGetPropertiesAllRequest request = new RopGetPropertiesAllRequest { RopId = (byte)RopId.RopGetPropertiesAll, LogonId = Constants.CommonLogonId, InputHandleIndex = 0, PropertySizeLimit = ushort.MaxValue, WantUnicode = 0x01 }; this.ExcuteRopCall((ISerializable)request, inputHandle, ref ropResponse, ref responseSOHTable, ref this.rawData); RopGetPropertiesAllResponse response = (RopGetPropertiesAllResponse)ropResponse; if (0x00000000 == response.ReturnValue) { this.VerifyGetFolderPropertiesAll(response); } return response; }
public void MSOXCROPS_S12_TC02_TestFailRPCForMaxPcbOut() { this.CheckTransportIsSupported(); if (Common.IsRequirementEnabled(454509, this.Site) || Common.IsRequirementEnabled(20009, this.Site)) { this.cropsAdapter.RpcConnect( Common.GetConfigurationPropertyValue("SutComputerName", this.Site), ConnectionType.PrivateMailboxServer, Common.GetConfigurationPropertyValue("UserEssdn", this.Site), Common.GetConfigurationPropertyValue("Domain", this.Site), Common.GetConfigurationPropertyValue("AdminUserName", this.Site), Common.GetConfigurationPropertyValue("PassWord", this.Site)); // Define data for properties string dataForProperties = string.Empty; dataForProperties += TestSuiteBase.DataForProperties; dataForProperties += TestSuiteBase.DataForProperties; dataForProperties += TestSuiteBase.DataForProperties; dataForProperties += TestSuiteBase.DataForProperties; dataForProperties += TestSuiteBase.DataForProperties; dataForProperties += TestSuiteBase.DataForProperties; dataForProperties += TestSuiteBase.DataForProperties; dataForProperties += TestSuiteBase.DataForProperties; int loopCounter = (LoopCounter / Encoding.ASCII.GetBytes(dataForProperties).Length) + 1; #region Common operations for RopGetStreamSize,RopSetStreamSize and RopSeekStream // Log on to a private mailbox. RopLogonResponse logonResponse = Logon(LogonType.Mailbox, this.userDN, out inputObjHandle); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Call GetCreatedMessageHandle method to create a message and get its handle."); // Call GetCreatedMessageHandle method to create a message and get its handle. uint messageHandle = GetCreatedMessageHandle(logonResponse.FolderIds[4], inputObjHandle); // Call GetOpenedStreamHandle method to open stream and get its handle. uint streamObjectHandle; for (int i = 0; i < loopCounter; i++) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Call GetOpenedStreamHandle method to open stream and get its handle:loop counter i={0}", i); streamObjectHandle = this.GetOpenedStreamHandle( messageHandle, (ushort)(this.propertyDictionary[PropertyNames.UserSpecified].PropertyId + i)); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Call WriteStream method to write stream:loop counter i={0}", i); // Call WriteStream method to write stream. this.WriteStream(streamObjectHandle, dataForProperties); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Call CommitStream method to commit source stream:loop counter i={0}", i); // Call CommitStream method to commit source stream. this.CommitStream(streamObjectHandle); #region Release the stream. RopReleaseRequest releaseRequest; releaseRequest.RopId = (byte)RopId.RopRelease; releaseRequest.LogonId = TestSuiteBase.LogonId; // Set InputHandleIndex to 0x0, which specifies the location in the Server object handle table // where the handle for the input Server object is stored. releaseRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex0; // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Begin to send the RopRelease request."); // Send a RopRelease request to release all resources associated with the Server object. this.responseSOHs = cropsAdapter.ProcessSingleRop( releaseRequest, streamObjectHandle, ref this.response, ref this.rawData, RopResponseType.SuccessResponse); #endregion } // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Call SaveMessage method to save message."); // Call SaveMessage method to save message. this.SaveMessage(messageHandle); #endregion #region Call RopGetPropertiesAll to make the response buffer larger than the maximum size specified in pcbOut RopGetPropertiesAllRequest getPropertiesAllRequest = new RopGetPropertiesAllRequest { RopId = (byte)RopId.RopGetPropertiesAll, LogonId = TestSuiteBase.LogonId, InputHandleIndex = TestSuiteBase.InputHandleIndex0, PropertySizeLimit = TestSuiteBase.PropertySizeLimit, WantUnicode = (ushort)Zero }; // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Begin to send the RopGetPropertiesAll request."); // Send the RopGetPropertiesAll request and verify RPC error response. this.responseSOHs = cropsAdapter.ProcessSingleRopWithOptionResponseBufferSize( getPropertiesAllRequest, messageHandle, ref this.response, ref this.rawData, RopResponseType.RPCError, 0x10); #endregion } else { Site.Assert.Inconclusive("This case runs only under Exchange 2010 and above, since Exchange 2007 does not support fail the RPC with 0x0000047D if the ROP output buffer is larger than the maximum size specified in request."); } }