Microsoft.Protocols.TestSuites.MS_OXCPRPT.MS_OXCPRPTAdapter.RopGetPropertiesAllMethod C# (CSharp) Method

RopGetPropertiesAllMethod() public method

This method is used to query for and return all of the property tags and values of properties that have been set.
public RopGetPropertiesAllMethod ( bool isPropertySizeLimitZero, bool isPropertyLagerThanLimit, bool isUnicode, bool &isValueContainsNotEnoughMemory ) : void
isPropertySizeLimitZero bool Indicates whether PropertySizeLimit parameter is zero.
isPropertyLagerThanLimit bool Indicates whether request properties larger than limit /// When PropertySizeLimit is non-zero, Indicates whether request properties larger than PropertySizeLimit /// When PropertySizeLimit is zero, Indicates whether request properties larger than size of response.
isUnicode bool Indicates whether the requested property is encoded in Unicode format in response buffer
isValueContainsNotEnoughMemory bool Indicates whether returned value contains NotEnoughMemory error when the request properties are too large.
return void
        public void RopGetPropertiesAllMethod(bool isPropertySizeLimitZero, bool isPropertyLagerThanLimit, bool isUnicode, out bool isValueContainsNotEnoughMemory)
        {
            #region Initialize parameters
            // Set default value for isValueContainsNotEnoughMemory parameter.
            isValueContainsNotEnoughMemory = false;

            // Set value for wantUnidcode field.
            ushort wantUnicode = 0;
            if (isUnicode)
            {
                wantUnicode = 1;
            }

            // Set value for propertySizeLimit field.
            ushort propertySizeLimit = 0;

            // Set value for propertySizeLimit field.
            if (!isPropertySizeLimitZero)
            {
                propertySizeLimit = PropertySizeLimit;
            }

            // Set value for tagPtyValues array.
            TaggedPropertyValue[] tagPtyValues = new TaggedPropertyValue[1];
            tagPtyValues[0] = this.GetTaggedPropertyTag(ObjectToOperate.FirstObject);

            // Set value as the larger one than the limited value.
            if (isPropertyLagerThanLimit)
            {
                List<byte> bytes = new List<byte>();
                foreach (byte b in tagPtyValues[0].Value)
                {
                    bytes.Add(b);
                }

                while (bytes.Count <= propertySizeLimit)
                {
                    bytes.Add(ConstValues.PropertyBytesFilling);
                }

                bytes.Add(ConstValues.PropertyBytesFilling);
                tagPtyValues[0].Value = bytes.ToArray();
            }

            if (tagPtyValues[0].PropertyTag.PropertyType == 0x0102)
            {
                tagPtyValues[0].Value = Common.AddInt16LengthBeforeBinaryArray(tagPtyValues[0].Value);
            }

            // Set Property before executing the query operation.
            this.RopSetProperties(this.cprptCurrentHandle, tagPtyValues, true);
            if (this.cprptCurrentType == ServerObjectType.Message)
            {
                this.RopSaveChangesMessage(this.cprptCurrentHandle, true);
            }
            else if (this.cprptCurrentType == ServerObjectType.Attachment)
            {
                this.RopSaveChangesAttachment(this.cprptCurrentHandle, true);
            }
            #endregion

            RopGetPropertiesAllResponse getPropertiesAllResponse = this.RopGetPropertiesAll(this.cprptCurrentHandle, propertySizeLimit, wantUnicode);

            if (this.cprptCurrentType == ServerObjectType.Message)
            {
                foreach (TaggedPropertyValue value in getPropertiesAllResponse.PropertyValues)
                {
                    byte[] notEnoughMemory = BitConverter.GetBytes((uint)CPRPTErrorCode.NotEnoughMemory);
                    if (Common.CompareByteArray(notEnoughMemory, value.Value))
                    {
                        isValueContainsNotEnoughMemory = true;
                    }
                }
            }

            if (this.cprptCurrentType == ServerObjectType.Attachment)
            {
                if (getPropertiesAllResponse.ReturnValue == (uint)CPRPTErrorCode.NotEnoughMemory)
                {
                    isValueContainsNotEnoughMemory = true;
                }
            }

            this.VerifyRopGetPropertiesAll(getPropertiesAllResponse, this.cprptCurrentType, isPropertySizeLimitZero, isPropertyLagerThanLimit, isUnicode, isValueContainsNotEnoughMemory);
        }
MS_OXCPRPTAdapter