Microsoft.Protocols.TestSuites.MS_LISTSWS.TestSuiteHelper.CreateQueryRoot C# (CSharp) Method

CreateQueryRoot() public static method

A method used to construct CamlQueryRoot instance using specified field name and value with equal condition.
public static CreateQueryRoot ( string fieldName, string fieldValue ) : CamlQueryRoot
fieldName string A parameter represents the field name.
fieldValue string A parameter represents the field value.
return Microsoft.Protocols.TestSuites.Common.CamlQueryRoot
        public static CamlQueryRoot CreateQueryRoot(string fieldName, string fieldValue)
        {
            CamlQueryRoot root = new CamlQueryRoot();
            root.Where = new LogicalJoinDefinition();

            LogicalTestDefinition equal = new LogicalTestDefinition();
            equal.FieldRef = new FieldRefDefinitionQueryTest();
            equal.FieldRef.Name = fieldName;

            ValueDefinition valueDef = new ValueDefinition();
            valueDef.Type = "Text";
            valueDef.Text = new string[] { fieldValue };
            equal.Value = valueDef;

            root.Where.Items = new object[1];
            root.Where.Items[0] = equal;

            root.Where.ItemsElementName = new ItemsChoiceType1[1];
            root.Where.ItemsElementName[0] = ItemsChoiceType1.Eq;

            return root;
        }