Microsoft.Protocols.TestSuites.MS_OXWSCORE.S01_ManageBaseItems.MSOXWSCORE_S01_TC43_RightsManagementLicenseDataIsReadOnly C# (CSharp) Method

MSOXWSCORE_S01_TC43_RightsManagementLicenseDataIsReadOnly() private method

        public void MSOXWSCORE_S01_TC43_RightsManagementLicenseDataIsReadOnly()
        {
            Site.Assume.IsTrue(Common.IsRequirementEnabled(1355, this.Site), "Exchange 2007 and Exchange 2010 do not support the RightsManagementLicenseData element.");

            #region Create an item with setting RightsManagementLicenseData
            ItemType[] createdItems = new ItemType[] { new ItemType() };
            createdItems[0].Subject = Common.GenerateResourceName(
                this.Site,
                TestSuiteHelper.SubjectForCreateItem);
            createdItems[0].RightsManagementLicenseData = new RightsManagementLicenseDataType();
            createdItems[0].RightsManagementLicenseData.EditAllowedSpecified = true;
            createdItems[0].RightsManagementLicenseData.EditAllowed = true;

            CreateItemResponseType createItemResponse = this.CallCreateItemOperation(DistinguishedFolderIdNameType.drafts, createdItems);

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R2052");

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R2052
            this.Site.CaptureRequirementIfAreEqual<ResponseCodeType>(
                ResponseCodeType.ErrorInvalidPropertySet,
                createItemResponse.ResponseMessages.Items[0].ResponseCode,
                2052,
                @"[In t:ItemType Complex Type] This element [RightsManagementLicenseData] is read-only.");
            #endregion

            #region Update an item with setting RightsManagementLicenseData
            ItemType item = new ItemType();
            ItemIdType[] createdItemIds = this.CreateItemWithMinimumElements(item);

            UpdateItemResponseType updateItemResponse;
            ItemChangeType[] itemChanges;

            itemChanges = new ItemChangeType[1];
            itemChanges[0] = new ItemChangeType();

            // Update the created item.
            itemChanges[0].Item = createdItemIds[0];
            itemChanges[0].Updates = new ItemChangeDescriptionType[1];
            SetItemFieldType setItem = new SetItemFieldType();
            setItem.Item = new PathToUnindexedFieldType()
            {
                FieldURI = UnindexedFieldURIType.itemRightsManagementLicenseData
            };
            setItem.Item1 = new ItemType()
            {
                RightsManagementLicenseData = new RightsManagementLicenseDataType
                {
                    EditAllowed = true,
                    EditAllowedSpecified = true
                }
            };
            itemChanges[0].Updates[0] = setItem;

            updateItemResponse = this.CallUpdateItemOperation(
                DistinguishedFolderIdNameType.drafts,
                true,
                itemChanges);

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R2353");

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R2353
            this.Site.CaptureRequirementIfAreEqual<ResponseCodeType>(
                ResponseCodeType.ErrorInvalidPropertySet,
                updateItemResponse.ResponseMessages.Items[0].ResponseCode,
                2353,
                @"[In t:ItemType Complex Type] but if [RightsManagementLicenseData] specified in a CreateItem or UpdateItem request, an ErrorInvalidPropertySet ([MS-OXWSCDATA] section 2.2.5.24) will be returned.");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1355");

            // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1355
            // Server handles the element RightsManagementLicenseData and returns ErrorInvalidPropertySet, this requirement can be captured directly.
            this.Site.CaptureRequirement(
                1355,
                @"[In Appendix C: Product Behavior] Implementation does support element ""RightsManagementLicenseData"" with type ""t:RightsManagementLicenseDataType (section 2.2.4.37)"" which specifies rights management license data. (Exchange 2013 and above follow this behavior.)");
            #endregion
        }
S01_ManageBaseItems