当前位置: 首页>>代码示例>>C#>>正文


C# Common.PropertyTag类代码示例

本文整理汇总了C#中Microsoft.Protocols.TestSuites.Common.PropertyTag的典型用法代码示例。如果您正苦于以下问题:C# PropertyTag类的具体用法?C# PropertyTag怎么用?C# PropertyTag使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


PropertyTag类属于Microsoft.Protocols.TestSuites.Common命名空间,在下文中一共展示了PropertyTag类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RopOpenStream

        /// <summary>
        /// This ROP opens a property for streaming access.
        /// </summary>
        /// <param name="objHandle">The handle to operate.</param>
        /// <param name="openStreamResponse">The response of this ROP.</param>
        /// <param name="tag">The propertyTag structure.</param>
        /// <param name="openMode">8-bit flags structure. These flags control how the stream is opened.</param>
        /// <param name="needVerify">Whether need to verify the response.</param>
        /// <returns>The handle returned.</returns>
        private uint RopOpenStream(uint objHandle, out RopOpenStreamResponse openStreamResponse, PropertyTag tag, byte openMode, bool needVerify)
        {
            this.rawDataValue = null;
            this.responseValue = null;
            this.responseSOHsValue = null;

            RopOpenStreamRequest openStreamRequest;

            openStreamRequest.RopId = (byte)RopId.RopOpenStream;
            openStreamRequest.LogonId = LogonId;
            openStreamRequest.InputHandleIndex = (byte)HandleIndex.FirstIndex;
            openStreamRequest.OutputHandleIndex = (byte)HandleIndex.SecondIndex;
            openStreamRequest.PropertyTag = tag;
            openStreamRequest.OpenModeFlags = openMode;

            this.responseSOHsValue = this.ProcessSingleRop(openStreamRequest, objHandle, ref this.responseValue, ref this.rawDataValue, RopResponseType.SuccessResponse);
            openStreamResponse = (RopOpenStreamResponse)this.responseValue;
            uint streamObjectHandle = this.responseSOHsValue[0][openStreamResponse.OutputHandleIndex];
            if (needVerify)
            {
                this.Site.Assert.AreEqual((uint)RopResponseType.SuccessResponse, openStreamResponse.ReturnValue, string.Format("RopOpenStream Failed! Error: 0x{0:X8}", openStreamResponse.ReturnValue));
            }

            return streamObjectHandle;
        }
开发者ID:OfficeDev,项目名称:Interop-TestSuites,代码行数:34,代码来源:OXCPRPTStream.cs

示例2: RopGetPropertiesSpecific

        /// <summary>
        /// RopGetPropertiesSpecific implementation
        /// </summary>
        /// <param name="objHandle">This index specifies the location in the Server object handle table where the handle for the input Server object is stored.</param>
        /// <param name="propertySizeLimit">This value specifies the maximum size allowed for a property value returned</param>
        /// <param name="wantUnicode">This value specifies whether to return string properties in Unicode</param>
        /// <param name="propertyTags">This field specifies the properties requested</param>
        /// <returns>Structure of RopGetPropertiesSpecificResponse</returns>
        private RopGetPropertiesSpecificResponse RopGetPropertiesSpecific(uint objHandle, ushort propertySizeLimit, ushort wantUnicode, PropertyTag[] propertyTags)
        {
            this.rawDataValue = null;
            this.responseValue = null;
            this.responseSOHsValue = null;

            RopGetPropertiesSpecificRequest getPropertiesSpecificRequest;
            RopGetPropertiesSpecificResponse getPropertiesSpecificResponse;

            getPropertiesSpecificRequest.RopId = (byte)RopId.RopGetPropertiesSpecific;
            getPropertiesSpecificRequest.LogonId = LogonId;
            getPropertiesSpecificRequest.InputHandleIndex = (byte)HandleIndex.FirstIndex;
            getPropertiesSpecificRequest.PropertySizeLimit = propertySizeLimit;
            getPropertiesSpecificRequest.WantUnicode = wantUnicode;
            if (propertyTags != null)
            {
                getPropertiesSpecificRequest.PropertyTagCount = (ushort)propertyTags.Length;
            }
            else
            {
                // PropertyTags is null, so count of propertyTags is zero
                getPropertiesSpecificRequest.PropertyTagCount = 0x00;
            }

            getPropertiesSpecificRequest.PropertyTags = propertyTags;

            this.responseSOHsValue = this.ProcessSingleRop(getPropertiesSpecificRequest, objHandle, ref this.responseValue, ref this.rawDataValue, RopResponseType.SuccessResponse);
            getPropertiesSpecificResponse = (RopGetPropertiesSpecificResponse)this.responseValue;
            return getPropertiesSpecificResponse;
        }
开发者ID:ClareMSYanGit,项目名称:Interop-TestSuites,代码行数:38,代码来源:OXCPRPTProperty.cs

示例3: Parse

 /// <summary>
 /// Parse bytes in context into TaggedPropertyValueNode
 /// </summary>
 /// <param name="context">The value of Context</param>
 public override void Parse(Context context)
 {
     // Parse PropertyType and assign it to context's current PropertyType
     Microsoft.Protocols.TestSuites.Common.PropertyTag p = new PropertyTag();
     context.CurIndex += p.Deserialize(context.PropertyBytes, context.CurIndex);
     context.CurProperty.Type = (PropertyType)p.PropertyType;
     this.PropertyTag = p;
     base.Parse(context);
 }
开发者ID:ClareMSYanGit,项目名称:Interop-TestSuites,代码行数:13,代码来源:TaggedPropertyValue.cs

示例4: Deserialize

 /// <summary>
 /// Deserialized byte array to a TagActionData instance
 /// </summary>
 /// <param name="buffer">Byte array contains data of an ActionData instance.</param>
 /// <returns>Bytes count that deserialized in buffer.</returns>
 public uint Deserialize(byte[] buffer)
 {
     BufferReader bufferReader = new BufferReader(buffer);
     PropertyTag propertyTag = new PropertyTag
     {
         PropertyType = bufferReader.ReadUInt16(),
         PropertyId = bufferReader.ReadUInt16()
     };
     this.PropertyTag = propertyTag;
     uint size = bufferReader.Position;
     this.PropertyValue = AdapterHelper.ReadValueByType(this.PropertyTag.PropertyType, bufferReader.ReadToEnd());
     size += (uint)this.PropertyValue.Length;
     return size;
 }
开发者ID:ClareMSYanGit,项目名称:Interop-TestSuites,代码行数:19,代码来源:TagActionData.cs

示例5: ReadTaggedProperty

        /// <summary>
        /// Get a TaggedPropertyValue structure from buffer.
        /// </summary>
        /// <param name="buffer">Buffer contain TaggedPropertyValue instance.</param>
        /// <returns>A TaggedPropertyvalue structure.</returns>
        public static TaggedPropertyValue ReadTaggedProperty(byte[] buffer)
        {
            TaggedPropertyValue tagValue = new TaggedPropertyValue();
            BufferReader bufferReader = new BufferReader(buffer);

            PropertyTag newPropertyTag = new PropertyTag
            {
                PropertyType = bufferReader.ReadUInt16(),
                PropertyId = bufferReader.ReadUInt16()
            };
            tagValue.PropertyTag = newPropertyTag;
            tagValue.Value = ReadValueByType(tagValue.PropertyTag.PropertyType, bufferReader.ReadToEnd());

            return tagValue;
        }
开发者ID:ClareMSYanGit,项目名称:Interop-TestSuites,代码行数:20,代码来源:AdapterHelper.cs

示例6: GetSubfolderIDByName

        /// <summary>
        /// Find a folder ID in the specified folder and with specified display name.
        /// </summary>
        /// <param name="parentFolderId">ID of the parent Folder.</param>
        /// <param name="logonHandle">The logon object handle.</param>
        /// <param name="folderName">The folder display name.</param>
        /// <returns>The folder ID.</returns>
        protected ulong GetSubfolderIDByName(ulong parentFolderId, uint logonHandle, string folderName)
        {
            ulong folderId = 0;
            uint parentFolderHandle = 0;
            this.OpenFolder(logonHandle, parentFolderId, ref parentFolderHandle);

            RopGetHierarchyTableRequest getHierarchyTableRequest = new RopGetHierarchyTableRequest
            {
                RopId = (byte)RopId.RopGetHierarchyTable,
                LogonId = Constants.CommonLogonId,
                InputHandleIndex = Constants.CommonInputHandleIndex,
                OutputHandleIndex = Constants.CommonOutputHandleIndex,
                TableFlags = (byte)FolderTableFlags.Depth
            };
            RopGetHierarchyTableResponse getHierarchyTableResponse = this.Adapter.GetHierarchyTable(getHierarchyTableRequest, parentFolderHandle, ref this.responseHandles);
            uint tableHandle = this.responseHandles[0][getHierarchyTableResponse.OutputHandleIndex];

            PropertyTag[] properties = new PropertyTag[]
            {
                new PropertyTag()
                {
                    PropertyId = (ushort)FolderPropertyId.PidTagDisplayName,
                    PropertyType = (ushort)PropertyType.PtypString
                },
                new PropertyTag()
                {
                    PropertyId = (ushort)FolderPropertyId.PidTagFolderId,
                    PropertyType = (ushort)PropertyType.PtypInteger64
                }
            };
            List<PropertyRow> propertyRows = this.GetTableRowValue(tableHandle, (ushort)getHierarchyTableResponse.RowCount, properties);

            if (propertyRows != null)
            {
                foreach (PropertyRow propertyRow in propertyRows)
                {
                    byte[] displayNameInBytes = propertyRow.PropertyValues[0].Value;
                    string displayName = Encoding.Unicode.GetString(displayNameInBytes, 0, displayNameInBytes.Length);
                    if (displayName.Equals(folderName, StringComparison.CurrentCultureIgnoreCase))
                    {
                        byte[] folderIdInBytes = propertyRow.PropertyValues[1].Value;
                        folderId = (ulong)BitConverter.ToInt64(folderIdInBytes, 0);
                        break;
                    }
                }
            }

            return folderId;
        }
开发者ID:OfficeDev,项目名称:Interop-TestSuites,代码行数:56,代码来源:TestSuiteBase.cs

示例7: CreateSampleRuleDataArrayForAdd

        /// <summary>
        /// Create sample RuleData array to modify the rules associated with a folder.
        /// </summary>
        /// <returns>Return RuleData array to be used in RopModifyRules request.</returns>
        protected RuleData[] CreateSampleRuleDataArrayForAdd()
        {
            int propertyValuesCount = 4;
            PropertyValue[] propertyValues = new PropertyValue[propertyValuesCount];

            for (int i = 0; i < propertyValuesCount; i++)
            {
                propertyValues[i] = new PropertyValue();
            }

            // As specified in section 2.2.1.3.2 in [MS-OXORULE],
            // when adding a PRULE, the client MUST NOT
            // pass in PidTagRuleId, it MUST pass in PidTagRuleCondition,
            // PidTagRuleActions and PidTagRuleProvider.
            TaggedPropertyValue taggedPropertyValue = new TaggedPropertyValue();
            PropertyTag tempPropertyTag = new PropertyTag
            {
                PropertyId = 0x6676, PropertyType = 0003
            };
            taggedPropertyValue.PropertyTag = tempPropertyTag;
            byte[] value3 = { 0x00, 0x00, 0x00, 0x0a };
            taggedPropertyValue.Value = value3;
            propertyValues[3].Value = taggedPropertyValue.Serialize();

            // PidTagRuleCondition
            taggedPropertyValue = new TaggedPropertyValue();
            tempPropertyTag.PropertyId = 0x6679;
            tempPropertyTag.PropertyType = 0x00fd;
            taggedPropertyValue.PropertyTag = tempPropertyTag;
            byte[] value =
            {
                0x03, 0x01, 0x00, 0x01, 0x00, 0x1f, 0x00, 0x37, 0x00, 0x1f, 0x00,
                0x37, 0x00, 0x50, 0x00, 0x72, 0x00, 0x6f, 0x00, 0x6a, 0x00, 0x65,
                0x00, 0x63, 0x00, 0x74, 0x00, 0x20, 0x00, 0x58, 0x00, 0x00, 0x00
            };
            taggedPropertyValue.Value = value;
            propertyValues[1].Value = taggedPropertyValue.Serialize();

            // PidTagRuleAction
            taggedPropertyValue = new TaggedPropertyValue();
            tempPropertyTag.PropertyId = 0x6680;
            tempPropertyTag.PropertyType = 0x00fe;
            taggedPropertyValue.PropertyTag = tempPropertyTag;
            byte[] value1 = { 0x01, 0x00, 0x09, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
            taggedPropertyValue.Value = value1;
            propertyValues[2].Value = taggedPropertyValue.Serialize();

            // PidTagRuleProvider
            taggedPropertyValue = new TaggedPropertyValue();
            tempPropertyTag.PropertyId = 0x6681;
            tempPropertyTag.PropertyType = 0x001f;
            taggedPropertyValue.PropertyTag = tempPropertyTag;
            byte[] value2 = Encoding.Unicode.GetBytes("RuleOrganizer\0");
            taggedPropertyValue.Value = value2;
            propertyValues[0].Value = taggedPropertyValue.Serialize();

            RuleData sampleRuleData = new RuleData
            {
                RuleDataFlags = 0x01,
                PropertyValueCount = (ushort)propertyValues.Length,
                PropertyValues = propertyValues
            };

            RuleData[] sampleRuleDataArray = new RuleData[1];
            sampleRuleDataArray[0] = sampleRuleData;

            return sampleRuleDataArray;
        }
开发者ID:OfficeDev,项目名称:Interop-TestSuites,代码行数:72,代码来源:TestSuiteBase.cs

示例8: CreateSampleRecipientColumnsAndRecipientRows

        /// <summary>
        /// This method creates Sample RecipientColumns and Sample RecipientRows.
        /// </summary>
        /// <param name="recipientColumns">Sample RecipientColumns</param>
        /// <param name="recipientRows">Sample RecipientRows</param>
        protected void CreateSampleRecipientColumnsAndRecipientRows(out PropertyTag[] recipientColumns, out ModifyRecipientRow[] recipientRows)
        {
            // Step 1: Create Sample RecipientColumns.
            #region recipientColumns

            // The following sample data is from MS-OXCMSG 4.7.1.
            PropertyTag[] sampleRecipientColumns = new PropertyTag[12];
            sampleRecipientColumns[0] = this.propertyDictionary[PropertyNames.PidTagObjectType];
            sampleRecipientColumns[1] = this.propertyDictionary[PropertyNames.PidTagDisplayType];
            sampleRecipientColumns[2] = this.propertyDictionary[PropertyNames.PidTagAddressBookDisplayNamePrintable];
            sampleRecipientColumns[3] = this.propertyDictionary[PropertyNames.PidTagSmtpAddress];
            sampleRecipientColumns[4] = this.propertyDictionary[PropertyNames.PidTagSendInternetEncoding];
            sampleRecipientColumns[5] = this.propertyDictionary[PropertyNames.PidTagDisplayTypeEx];
            sampleRecipientColumns[6] = this.propertyDictionary[PropertyNames.PidTagRecipientDisplayName];
            sampleRecipientColumns[7] = this.propertyDictionary[PropertyNames.PidTagRecipientFlags];
            sampleRecipientColumns[8] = this.propertyDictionary[PropertyNames.PidTagRecipientTrackStatus];
            sampleRecipientColumns[9] = this.propertyDictionary[PropertyNames.PidTagRecipientResourceState];
            sampleRecipientColumns[10] = this.propertyDictionary[PropertyNames.PidTagRecipientOrder];
            sampleRecipientColumns[11] = this.propertyDictionary[PropertyNames.PidTagRecipientEntryId];
            recipientColumns = sampleRecipientColumns;

            #endregion

            // Step 2: Configure a StandardPropertyRow: propertyRow.
            #region Configure a StandardPropertyRow: propertyRow, data is from Page 62 of MS-OXCMSG

            PropertyValue[] propertyValueArray = new PropertyValue[12];
            for (int i = 0; i < propertyValueArray.Length; i++)
            {
                propertyValueArray[i] = new PropertyValue();
            }

            // PidTagObjectType
            propertyValueArray[0].Value = BitConverter.GetBytes(0x00000006);

            // PidTagDisplayType
            propertyValueArray[1].Value = BitConverter.GetBytes(0x00000000);

            // PidTa7BitDisplayName
            propertyValueArray[2].Value = Encoding.Unicode.GetBytes(Common.GetConfigurationPropertyValue("EmailAlias", this.Site) + "\0");

            // PidTagSmtpAddress
            propertyValueArray[3].Value = Encoding.Unicode.GetBytes(Common.GetConfigurationPropertyValue("EmailAlias", this.Site) + "@" + Common.GetConfigurationPropertyValue("Domain", this.Site) + "\0");

            // PidTagSendInternetEncoding
            propertyValueArray[4].Value = BitConverter.GetBytes(0x00000000);

            // PidTagDisplayTypeEx
            propertyValueArray[5].Value = BitConverter.GetBytes(0x40000000);

            // PidTagRecipientDisplayName
            propertyValueArray[6].Value = Encoding.Unicode.GetBytes(Common.GetConfigurationPropertyValue("EmailAlias", this.Site) + "\0");

            // PidTagRecipientFlags
            propertyValueArray[7].Value = BitConverter.GetBytes(0x00000001);

            // PidTagRecipientTrackStatus
            propertyValueArray[8].Value = BitConverter.GetBytes(0x00000000);

            // PidTagRecipientResourceState
            propertyValueArray[9].Value = BitConverter.GetBytes(0x00000000);

            // PidTagRecipientOrder
            propertyValueArray[10].Value = BitConverter.GetBytes(0x00000000);

            // The following sample data (0x007c and the subsequent 124(0x7c) binary)
            // is copied from Page 62 of MS-OXCMSG
            byte[] sampleData = 
            { 
                0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0xa7, 0x40, 0xc8,
                0xc0, 0x42, 0x10, 0x1a, 0xb4, 0xb9, 0x08, 0x00, 0x2b, 0x2f,
                0xe1, 0x82, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                0x2f, 0x6f, 0x3d, 0x46, 0x69, 0x72, 0x73, 0x74, 0x20, 0x4f,
                0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f,
                0x6e, 0x2f, 0x6f, 0x75, 0x3d, 0x45, 0x78, 0x63, 0x68, 0x61,
                0x6e, 0x67, 0x65, 0x20, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x69,
                0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x76, 0x65, 0x20, 0x47,
                0x72, 0x6f, 0x75, 0x70, 0x20, 0x28, 0x46, 0x59, 0x44, 0x49,
                0x42, 0x4f, 0x48, 0x46, 0x32, 0x33, 0x53, 0x50, 0x44, 0x4c,
                0x54, 0x29, 0x2f, 0x63, 0x6e, 0x3d, 0x52, 0x65, 0x63, 0x69,
                0x70, 0x69, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x63, 0x6e, 0x3d,
                0x75, 0x73, 0x65, 0x72, 0x32, 0x00 
            };

            // PidTagRecipientEntryId
            propertyValueArray[11].Value = sampleData;

            List<PropertyValue> propertyValues = new List<PropertyValue>();
            for (int i = 0; i < propertyValueArray.Length; i++)
            {
                propertyValues.Add(propertyValueArray[i]);
            }

            PropertyRow propertyRow = new PropertyRow
            {
//.........这里部分代码省略.........
开发者ID:OfficeDev,项目名称:Interop-TestSuites,代码行数:101,代码来源:TestSuiteBase.cs

示例9: GetTableRowValue

        /// <summary>
        /// Get the properties' value from the rows of the table.
        /// </summary>
        /// <param name="tableHandle">The table handle.</param>
        /// <param name="rowCount">The amount of the rows.</param>
        /// <param name="properties">The properties need to show.</param>
        /// <returns>The property rows in the specified table object.</returns>
        private List<PropertyRow> GetTableRowValue(uint tableHandle, ushort rowCount, PropertyTag[] properties)
        {
            #region The client calls RopSetColumns operation to set the property information to show.

            RopSetColumnsRequest setColumnsRequest = new RopSetColumnsRequest
            {
                RopId = (byte)RopId.RopSetColumns,
                LogonId = TestSuiteBase.LogonId,
                InputHandleIndex = TestSuiteBase.InputHandleIndex0,
                PropertyTagCount = (ushort)properties.Length,
                PropertyTags = properties,
                SetColumnsFlags = (byte)AsynchronousFlags.None
            };
            this.responseSOHs = this.cropsAdapter.ProcessSingleRop(
                    setColumnsRequest,
                    tableHandle,
                    ref this.response,
                    ref this.rawData,
                    RopResponseType.SuccessResponse);
            RopSetColumnsResponse setColumnsResponse = (RopSetColumnsResponse)this.response;

            Site.Assert.AreEqual<uint>(
                TestSuiteBase.SuccessReturnValue,
                setColumnsResponse.ReturnValue,
                "if ROP succeeds, the ReturnValue of its response is 0(success)");

            #endregion

            #region The client calls RopQueryRows operation to query the folder which have the special properties.

            RopQueryRowsRequest queryRowsRequest = new RopQueryRowsRequest
            {
                RopId = (byte)RopId.RopQueryRows,
                LogonId = TestSuiteBase.LogonId,
                InputHandleIndex = TestSuiteBase.InputHandleIndex0,
                RowCount = (ushort)rowCount,
                QueryRowsFlags = (byte)QueryRowsFlags.Advance,
                ForwardRead = 0x01
            };
            this.responseSOHs = this.cropsAdapter.ProcessSingleRop(
                    queryRowsRequest,
                    tableHandle,
                    ref this.response,
                    ref this.rawData,
                    RopResponseType.SuccessResponse);
            RopQueryRowsResponse queryRowsResponse = (RopQueryRowsResponse)this.response;

            Site.Assert.AreEqual<uint>(
                TestSuiteBase.SuccessReturnValue,
                queryRowsResponse.ReturnValue,
                "if ROP succeeds, the ReturnValue of its response is 0(success)");

            #endregion

            return queryRowsResponse.RowData.PropertyRows;
        }
开发者ID:OfficeDev,项目名称:Interop-TestSuites,代码行数:63,代码来源:TestSuiteBase.cs

示例10: GetSubfolderIDByName

        /// <summary>
        /// Find a folder ID in the specified folder and with specified display name.
        /// </summary>
        /// <param name="openedFolderHandle">Handle of the parent folder.</param>
        /// <param name="folderName">The folder display name.</param>
        /// <returns>The folder ID.</returns>
        protected ulong GetSubfolderIDByName(uint openedFolderHandle, string folderName)
        {
            RopGetHierarchyTableRequest getHierarchyTableRequest = new RopGetHierarchyTableRequest();
            RopGetHierarchyTableResponse getHierarchyTableResponse = new RopGetHierarchyTableResponse();
            getHierarchyTableRequest.RopId = (byte)RopId.RopGetHierarchyTable;
            getHierarchyTableRequest.LogonId = TestSuiteBase.LogonId;
            getHierarchyTableRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex0;
            getHierarchyTableRequest.OutputHandleIndex = TestSuiteBase.OutputHandleIndex1;
            getHierarchyTableRequest.TableFlags = (byte)FolderTableFlags.Depth;
            this.responseSOHs = this.cropsAdapter.ProcessSingleRop(
                getHierarchyTableRequest,
                openedFolderHandle,
                ref this.response,
                ref this.rawData,
                RopResponseType.SuccessResponse);
            getHierarchyTableResponse = (RopGetHierarchyTableResponse)this.response;
            uint tableHandle = this.responseSOHs[0][getHierarchyTableResponse.OutputHandleIndex];

            PropertyTag[] properties = new PropertyTag[]
            {
                new PropertyTag()
                {
                    PropertyId = this.propertyDictionary[PropertyNames.PidTagDisplayName].PropertyId,
                    PropertyType = (ushort)PropertyType.PtypString
                },
                new PropertyTag()
                {
                    PropertyId = (ushort)this.propertyDictionary[PropertyNames.PidTagFolderId].PropertyId,
                    PropertyType = (ushort)PropertyType.PtypInteger64
                }
            };
            List<PropertyRow> propertyRows = this.GetTableRowValue(tableHandle, (ushort)getHierarchyTableResponse.RowCount, properties);

            ulong folderId = 0;
            foreach (PropertyRow propertyRow in propertyRows)
            {
                byte[] displayNameInBytes = propertyRow.PropertyValues[0].Value;
                string displayName = Encoding.Unicode.GetString(displayNameInBytes, 0, displayNameInBytes.Length);
                if (displayName.ToLower() == folderName.ToLower())
                {
                    byte[] folderIdInBytes = propertyRow.PropertyValues[1].Value;
                    folderId = (ulong)BitConverter.ToInt64(folderIdInBytes, 0);
                    break;
                }
            }

            return folderId;
        }
开发者ID:OfficeDev,项目名称:Interop-TestSuites,代码行数:54,代码来源:TestSuiteBase.cs

示例11: GetNamedPropertyValues

        /// <summary>
        /// Get the named properties value of specified Message object.
        /// </summary>
        /// <param name="longIdProperties">The list of named properties</param>
        /// <param name="messageHandle">The object handle of specified Message object.</param>
        /// <returns>Returns named property values of specified Message object.</returns>
        public Dictionary<PropertyNames, byte[]> GetNamedPropertyValues(List<PropertyNameObject> longIdProperties, uint messageHandle)
        {
            object response = null;
            byte[] rawData = null;

            #region Call RopGetPropertyIdsFromNames to get property ID.
            PropertyName[] propertyNames = new PropertyName[longIdProperties.Count];

            for (int i = 0; i < longIdProperties.Count; i++)
            {
                propertyNames[i] = longIdProperties[i].PropertyName;
            }

            RopGetPropertyIdsFromNamesRequest getPropertyIdsFromNamesRequest;
            RopGetPropertyIdsFromNamesResponse getPropertyIdsFromNamesResponse;
            getPropertyIdsFromNamesRequest.RopId = (byte)RopId.RopGetPropertyIdsFromNames;
            getPropertyIdsFromNamesRequest.LogonId = 0x00;
            getPropertyIdsFromNamesRequest.InputHandleIndex = 0x00;
            getPropertyIdsFromNamesRequest.Flags = (byte)GetPropertyIdsFromNamesFlags.Create;
            getPropertyIdsFromNamesRequest.PropertyNameCount = (ushort)propertyNames.Length;
            getPropertyIdsFromNamesRequest.PropertyNames = propertyNames;

            this.DoRopCall(getPropertyIdsFromNamesRequest, messageHandle, ref response, ref rawData, GetPropertiesFlags.None);
            getPropertyIdsFromNamesResponse = (RopGetPropertyIdsFromNamesResponse)response;
            Site.Assert.AreEqual<uint>(0, getPropertyIdsFromNamesResponse.ReturnValue, "Call RopGetPropertyIdsFromNames should success.");
            #endregion

            #region Call RopGetPropertiesSpecific to get the specific properties of specific message object.
            // Get specific property for created message
            RopGetPropertiesSpecificRequest getPropertiesSpecificRequest = new RopGetPropertiesSpecificRequest();
            RopGetPropertiesSpecificResponse getPropertiesSpecificResponse;
            getPropertiesSpecificRequest.RopId = (byte)RopId.RopGetPropertiesSpecific;
            getPropertiesSpecificRequest.LogonId = 0x00;
            getPropertiesSpecificRequest.InputHandleIndex = 0x00;
            getPropertiesSpecificRequest.PropertySizeLimit = 0xFFFF;

            PropertyTag[] tagArray = new PropertyTag[longIdProperties.Count];
            for (int j = 0; j < getPropertyIdsFromNamesResponse.PropertyIds.Length; j++)
            {
                tagArray[j] = new PropertyTag
                {
                    PropertyId = getPropertyIdsFromNamesResponse.PropertyIds[j].ID,
                    PropertyType = (ushort)longIdProperties[j].PropertyType
                };
            }

            getPropertiesSpecificRequest.PropertyTagCount = (ushort)tagArray.Length;
            getPropertiesSpecificRequest.PropertyTags = tagArray;

            this.DoRopCall(getPropertiesSpecificRequest, messageHandle, ref response, ref rawData, GetPropertiesFlags.None);
            getPropertiesSpecificResponse = (RopGetPropertiesSpecificResponse)response;
            Site.Assert.AreEqual<uint>(0, getPropertiesSpecificResponse.ReturnValue, "Calling RopGetPropertiesSpecific should be successful.");

            Dictionary<PropertyNames, byte[]> propertyList = new Dictionary<PropertyNames, byte[]>();
            PropertyObj propertyObjPidLidCommonStart = null;
            PropertyObj propertyObjPidLidCommonEnd = null;

            for (int i = 0; i < getPropertiesSpecificResponse.RowData.PropertyValues.Count; i++)
            {
                PropertyObj propertyObj = new PropertyObj
                {
                    PropertyName = longIdProperties[i].DisplayName,
                    ValueType = longIdProperties[i].PropertyType
                };
                PropertyHelper.GetPropertyObjFromBuffer(propertyObj, getPropertiesSpecificResponse.RowData.PropertyValues[i].Value);

                // Verify requirements related with named properties PidNameKeywords, PidNameContentBase, PidNameAcceptLanguage and PidNameContentClass.
                this.VerifyMessageSyntaxDataType(propertyObj);

                if (propertyObj.PropertyName == PropertyNames.PidLidCommonStart)
                {
                    propertyObjPidLidCommonStart = propertyObj;
                }

                if (propertyObj.PropertyName == PropertyNames.PidLidCommonEnd)
                {
                    propertyObjPidLidCommonEnd = propertyObj;
                }

                propertyList.Add(longIdProperties[i].DisplayName, getPropertiesSpecificResponse.RowData.PropertyValues[i].Value);
            }

            // Verify the requirements of PidLidCommonStart and PidLidCommonEnd.
            if (PropertyHelper.IsPropertyValid(propertyObjPidLidCommonStart) || PropertyHelper.IsPropertyValid(propertyObjPidLidCommonEnd))
            {
                this.VerifyMessageSyntaxPidLidCommonStartAndPidLidCommonEnd(propertyObjPidLidCommonStart, propertyObjPidLidCommonEnd);
            }
            #endregion

            return propertyList;
        }
开发者ID:OfficeDev,项目名称:Interop-TestSuites,代码行数:97,代码来源:MS-OXCMSGAdapter.cs

示例12: MSOXORULE_S01_TC06_AddMoveCopyAndBounceDeferredrules

        public void MSOXORULE_S01_TC06_AddMoveCopyAndBounceDeferredrules()
        {
            this.CheckMAPIHTTPTransportSupported();

            #region TestUser1 prepares value for ruleProperties variable.
            RuleProperties ruleProperties = AdapterHelper.GenerateRuleProperties(this.Site, Constants.RuleNameBounce);
            #endregion

            #region TestUser1 adds Bounce rule.
            BounceActionData bounceActionData = new BounceActionData
            {
                Bounce = BounceCode.CanNotDisplay
            };

            RuleData ruleBounce = AdapterHelper.GenerateValidRuleData(ActionType.OP_BOUNCE, TestRuleDataType.ForAdd, 0, RuleState.ST_ENABLED, bounceActionData, ruleProperties, null);
            RopModifyRulesResponse ropModifyRulesResponse = this.OxoruleAdapter.RopModifyRules(this.InboxFolderHandle, ModifyRuleFlag.Modify_ReplaceAll, new RuleData[] { ruleBounce });
            Site.Assert.AreEqual<uint>(0, ropModifyRulesResponse.ReturnValue, "Adding Bounce rule should succeed.");
            #endregion

            #region TestUser1 adds Deferred Action rule.
            ruleProperties.Name = Common.GenerateResourceName(this.Site, Constants.RuleNameDeferredAction);
            DeferredActionData deferredActionData = new DeferredActionData
            {
                Data = Common.GetBytesFromBinaryHexString(Constants.DeferredActionBufferData)
            };
            RuleData deferredActionRuleData = AdapterHelper.GenerateValidRuleData(ActionType.OP_DEFER_ACTION, TestRuleDataType.ForAdd, 1, RuleState.ST_ENABLED, deferredActionData, ruleProperties, null);

            RopModifyRulesResponse modifyRulesResponse = this.OxoruleAdapter.RopModifyRules(this.InboxFolderHandle, ModifyRuleFlag.Modify_OnExisting, new RuleData[] { deferredActionRuleData });
            Site.Assert.AreEqual<uint>(0, modifyRulesResponse.ReturnValue, "Adding deferred action rule to public folder should succeed.");
            #endregion

            if (Common.IsRequirementEnabled(294, this.Site))
            {
                #region TestUser1 creates a folder in server store.
                RopCreateFolderResponse createFolderResponse;
                string user1FolderName = Common.GenerateResourceName(this.Site, "User1Folder");
                uint folderHandle = this.OxoruleAdapter.RopCreateFolder(this.InboxFolderHandle, user1FolderName, "TestForOP_COPY", out createFolderResponse);
                ulong folderId = createFolderResponse.FolderId;
                Site.Assert.AreEqual<uint>(0, createFolderResponse.ReturnValue, "Creating folder operation should succeed.");
                #endregion

                #region TestUser1 prepares rules' data.
                MoveCopyActionData moveCopyActionData = new MoveCopyActionData();

                // Get the created folder entry ID.
                byte[] folderEId = this.OxoruleAdapter.GetFolderEntryId(StoreObjectType.Mailbox, folderHandle, folderId);

                // Get the store object's entry ID.
                byte[] storeEId = this.GetStoreObjectEntryID(StoreObjectType.Mailbox, this.Server, this.User1ESSDN);
                moveCopyActionData.FolderEID = folderEId;
                moveCopyActionData.StoreEID = storeEId;
                moveCopyActionData.FolderEIDSize = (ushort)folderEId.Length;
                moveCopyActionData.StoreEIDSize = (ushort)storeEId.Length;
                #endregion

                #region TestUSer1 generates test RuleData.
                ruleProperties.Name = Common.GenerateResourceName(this.Site, Constants.RuleNameCopy);
                RuleData ruleForCopy = AdapterHelper.GenerateValidRuleData(ActionType.OP_COPY, TestRuleDataType.ForAdd, 2, RuleState.ST_ENABLED, moveCopyActionData, ruleProperties, null);

                // Add rule for move with rule Provider Data.
                ruleProperties.ProviderData = Constants.PidTagRuleProviderData;
                ruleProperties.Name = Common.GenerateResourceName(this.Site, Constants.RuleNameMoveOne);
                RuleData ruleForMove = AdapterHelper.GenerateValidRuleData(ActionType.OP_MOVE, TestRuleDataType.ForAdd, 3, RuleState.ST_ENABLED, moveCopyActionData, ruleProperties, null);
                #endregion

                #region TestUser1 adds OP_MOVE and OP_COPY rules to the Inbox folder.
                modifyRulesResponse = this.OxoruleAdapter.RopModifyRules(this.InboxFolderHandle, ModifyRuleFlag.Modify_OnExisting, new RuleData[] { ruleForMove, ruleForCopy });

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

                // Verify MS-OXORULE requirement: MS-OXORULE_R680.
                // If the return value of the RopModifyRules response is 0x00, it means operation is successfully.
                Site.CaptureRequirementIfAreEqual<uint>(
                    0x00000000,
                    modifyRulesResponse.ReturnValue,
                    680,
                    @"[In RopModifyRules ROP Response Buffer] ReturnValue: To indicate success, the server returns 0x00000000.");

                // Wait for the mail to be received and the rule to take effect.
                Thread.Sleep(this.WaitForTheRuleToTakeEffect);
                #endregion

                RopDeleteFolderResponse deleteFolder = this.OxoruleAdapter.RopDeleteFolder(this.InboxFolderHandle, folderId);
                Site.Assert.AreEqual<uint>(0, deleteFolder.ReturnValue, "Deleting folder should succeed.");
            }

            #region TestUser1 gets rows from the rule table.
            RopGetRulesTableResponse ropGetRulesTableResponse;
            uint ruleTableHandle = this.OxoruleAdapter.RopGetRulesTable(this.InboxFolderHandle, TableFlags.Normal, out ropGetRulesTableResponse);
            Site.Assert.AreEqual<uint>(0, ropGetRulesTableResponse.ReturnValue, "RopGetRulesTable operation should succeed.");

            PropertyTag[] propertyListTag = new PropertyTag[4];

            // PidTagRuleActions property.
            propertyListTag[0].PropertyId = (ushort)PropertyId.PidTagRuleActions;
            propertyListTag[0].PropertyType = (ushort)PropertyType.PtypRuleAction;
            propertyListTag[1].PropertyId = (ushort)PropertyId.PidTagRuleName;
            propertyListTag[1].PropertyType = (ushort)PropertyType.PtypString;
            propertyListTag[2].PropertyId = (ushort)PropertyId.PidTagRuleProvider;
//.........这里部分代码省略.........
开发者ID:OfficeDev,项目名称:Interop-TestSuites,代码行数:101,代码来源:S01_AddModifyDeleteRetrieveRules.cs

示例13: TryGetLogonPropertyValue

        /// <summary>
        /// This method is used to send the ROP of RopGetPropertiesSpecificRequest to get the specific property value.
        /// </summary>
        /// <param name="propTag">The specified property</param>
        /// <returns>Return byte array</returns>
        protected byte[] TryGetLogonPropertyValue(PropertyTag propTag)
        {
            PropertyTag[] tags = new PropertyTag[1];
            tags[0] = propTag;
            #region Construct the request buffer
            RopGetPropertiesSpecificRequest getPropertiesSpecificRequest = new RopGetPropertiesSpecificRequest
            {
                RopId = 0x07,
                LogonId = 0x0,
                InputHandleIndex = 0x0,
                PropertySizeLimit = 0xFFFF, // Specifies the maximum size allowed for a property value returned
                PropertyTagCount = (ushort)tags.Length,
                PropertyTags = tags
            };
            #endregion

            this.oxcstorAdapter.DoRopCall(getPropertiesSpecificRequest, this.outObjHandle, ROPCommandType.RopGetPropertiesSpecific, out this.outputBuffer);
            RopGetPropertiesSpecificResponse getPropertiesSpecificResponse = (RopGetPropertiesSpecificResponse)this.outputBuffer.RopsList[0];

            #region Check the response and return
            if ((getPropertiesSpecificResponse.ReturnValue == 0) && (getPropertiesSpecificResponse.RowData != null))
            {
                return getPropertiesSpecificResponse.RowData.PropertyValues[0].Value;
            }
            else
            {
                return null;
            }
            #endregion Check the response and return
        }
开发者ID:OfficeDev,项目名称:Interop-TestSuites,代码行数:35,代码来源:TestSuiteBase.cs

示例14: TryDeleteLogonProperty

        /// <summary>
        /// This method is used to send the ROP of RopDeletePropertiesRequest to delete the specific property.
        /// </summary>
        /// <param name="propTag">The specified property</param>
        /// <returns>0 indicates success, others indicates error occurs.</returns>
        protected uint TryDeleteLogonProperty(PropertyTag propTag)
        {
            uint retValue = 0;
            PropertyTag[] tags = new PropertyTag[1];
            tags[0] = propTag;

            #region Construct the request buffer
            RopDeletePropertiesRequest deletePropertiesRequest;

            deletePropertiesRequest.RopId = 0x0B;
            deletePropertiesRequest.LogonId = 0x0;
            deletePropertiesRequest.InputHandleIndex = 0x0;

            // Specifies how many tags are present in PropertyTags
            deletePropertiesRequest.PropertyTagCount = (ushort)tags.Length;
            deletePropertiesRequest.PropertyTags = tags;
            #endregion

            this.oxcstorAdapter.DoRopCall(deletePropertiesRequest, this.outObjHandle, ROPCommandType.RopDeleteProperties, out this.outputBuffer);
            RopDeletePropertiesResponse deletePropertiesResponse = (RopDeletePropertiesResponse)this.outputBuffer.RopsList[0];

            #region Check the response
            if (deletePropertiesResponse.ReturnValue == 0x00)
            {
                // The return value is 0 to indicate that the method invoking successfully.
                if (deletePropertiesResponse.PropertyProblems != null && deletePropertiesResponse.PropertyProblemCount > 0)
                {
                    retValue = deletePropertiesResponse.PropertyProblems[0].ErrorCode;
                }
            }
            else
            {
                retValue = deletePropertiesResponse.ReturnValue;
            }
            #endregion

            return retValue;
        }
开发者ID:OfficeDev,项目名称:Interop-TestSuites,代码行数:43,代码来源:TestSuiteBase.cs

示例15: TryGetLogonProperty

        /// <summary>
        /// This method is used to send the ROP of RopGetPropertiesSpecificRequest to get the specific property.
        /// </summary>
        /// <param name="propTag">The specified property</param>
        /// <returns>0 indicates success, others indicates error occurs.</returns>
        protected uint TryGetLogonProperty(PropertyTag propTag)
        {
            uint retValue = 0;
            PropertyTag[] tags = new PropertyTag[1];
            tags[0] = propTag;

            #region Construct the request buffer
            RopGetPropertiesSpecificRequest getPropertiesSpecificRequest = new RopGetPropertiesSpecificRequest
            {
                RopId = 0x07,
                LogonId = 0x0,
                InputHandleIndex = 0x0,
                PropertySizeLimit = 0xFFFF, // Specifies the maximum size allowed for a property value returned
                PropertyTagCount = (ushort)tags.Length,
                PropertyTags = tags
            };
            #endregion

            this.oxcstorAdapter.DoRopCall(getPropertiesSpecificRequest, this.outObjHandle, ROPCommandType.RopGetPropertiesSpecific, out this.outputBuffer);
            RopGetPropertiesSpecificResponse getPropertiesSpecificResponse = (RopGetPropertiesSpecificResponse)this.outputBuffer.RopsList[0];

            #region Check the response
            if (getPropertiesSpecificResponse.ReturnValue == 0)
            {
                // The return value is 0 to indicate that the method invoking successfully.
                if (getPropertiesSpecificResponse.RowData.PropertyValues == null ||
                    getPropertiesSpecificResponse.RowData.PropertyValues.Count <= 0)
                {
                    // The case that the operation of set property executes failed for other reasons.
                    Site.Assert.Fail("The property value is not returned when calling RopGetPropertiesSpecific ROP.");
                }
            }
            else
            {
                retValue = getPropertiesSpecificResponse.ReturnValue;
            }
            #endregion

            return retValue;
        }
开发者ID:OfficeDev,项目名称:Interop-TestSuites,代码行数:45,代码来源:TestSuiteBase.cs


注:本文中的Microsoft.Protocols.TestSuites.Common.PropertyTag类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。