QueryByAttribute Class

 

Applies To: Dynamics 365 (online), Dynamics 365 (on-premises), Dynamics CRM 2016, Dynamics CRM Online

Contains a query that is expressed as a set of attribute and value pairs.

Namespace:   Microsoft.Xrm.Sdk.Query
Assembly:  Microsoft.Xrm.Sdk (in Microsoft.Xrm.Sdk.dll)

Inheritance Hierarchy

System.Object
  Microsoft.Xrm.Sdk.Query.QueryBase
    Microsoft.Xrm.Sdk.Query.QueryByAttribute

Syntax

[DataContractAttribute(Name = "QueryByAttribute", Namespace = "https://schemas.microsoft.com/xrm/2011/Contracts")]
public sealed class QueryByAttribute : QueryBase
<DataContractAttribute(Name := "QueryByAttribute", Namespace := "https://schemas.microsoft.com/xrm/2011/Contracts")>
Public NotInheritable Class QueryByAttribute
    Inherits QueryBase

Constructors

Name Description
System_CAPS_pubmethod QueryByAttribute()

Initializes a new instance of the QueryByAttribute class.

System_CAPS_pubmethod QueryByAttribute(String)

Initializes a new instance of the QueryByAttribute class.

Properties

Name Description
System_CAPS_pubproperty Attributes

Gets the set of attributes selected in the query.

System_CAPS_pubproperty ColumnSet

Gets or sets the column set.

System_CAPS_pubproperty EntityName

Gets or sets the logical name of the entity to query.

System_CAPS_pubproperty ExtensionData

Gets or sets the structure that contains extra data.(Inherited from QueryBase.)

System_CAPS_pubproperty Orders

Gets the order in which the entity instances are returned from the query.

System_CAPS_pubproperty PageInfo

Gets or sets the number of pages and the number of entity instances per page returned from the query.

System_CAPS_pubproperty TopCount

Gets or sets the number of rows to be returned.

System_CAPS_pubproperty Values

Gets the attribute values to look for when the query is executed.

Methods

Name Description
System_CAPS_pubmethod AddAttributeValue(String, Object)

Adds an attribute value to the attributes collection.

System_CAPS_pubmethod AddOrder(String, OrderType)

Adds an order to the orders collection.

System_CAPS_pubmethod Equals(Object)

(Inherited from Object.)

System_CAPS_pubmethod GetHashCode()

(Inherited from Object.)

System_CAPS_pubmethod GetType()

(Inherited from Object.)

System_CAPS_pubmethod ToString()

(Inherited from Object.)

Examples

//  Create query using QueryByAttribute.
QueryByAttribute querybyattribute = new QueryByAttribute("account") {
   ColumnSet = new ColumnSet("name", "address1_city", "emailaddress1"),
   Attributes.AddRange("address1_city"),
   Values.AddRange("Redmond")
};

Thread Safety

Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Microsoft.Xrm.Sdk.Query Namespace
Build queries with QueryExpression
Sample: Retrieve multiple with the QueryByAttribute class

Return to top

Microsoft Dynamics 365

© 2016 Microsoft. All rights reserved. Copyright