Share via


MetadataFilterExpression Class

 

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

Specifies complex condition and logical filter expressions used for filtering the results of a metadata query.

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

Inheritance Hierarchy

System.Object
  Microsoft.Xrm.Sdk.Metadata.Query.MetadataFilterExpression

Syntax

[DataContractAttribute(Name = "MetadataFilterExpression", Namespace = "https://schemas.microsoft.com/xrm/2011/Metadata/Query")]
public sealed class MetadataFilterExpression : IExtensibleDataObject
<DataContractAttribute(Name := "MetadataFilterExpression", Namespace := "https://schemas.microsoft.com/xrm/2011/Metadata/Query")>
Public NotInheritable Class MetadataFilterExpression
    Implements IExtensibleDataObject

Constructors

Name Description
System_CAPS_pubmethod MetadataFilterExpression()

Initializes a new instance of the MetadataFilterExpression class.

System_CAPS_pubmethod MetadataFilterExpression(LogicalOperator)

Initializes a new instance of the MetadataFilterExpression class.

Properties

Name Description
System_CAPS_pubproperty Conditions

Gets condition expressions that include metadata properties, condition operators and values.

System_CAPS_pubproperty ExtensionData

Gets or sets the structure that contains extra data.

System_CAPS_pubproperty FilterOperator

Gets or sets the logical AND/OR filter operator.

System_CAPS_pubproperty Filters

Gets a collection of logical filter expressions that filter the results of the metadata query.

Methods

Name Description
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.)

Remarks

The following example shows the use of a MetadataFilterExpression to return non-intersect, user-owned entities not found in a list of excluded entities.



     // An array SchemaName values for non-intersect, user-owned entities that should not be returned.
     String[] excludedEntities = {
"WorkflowLog",
"Template",
"CustomerOpportunityRole",
"Import",
"UserQueryVisualization",
"UserEntityInstanceData",
"ImportLog",
"RecurrenceRule",
"QuoteClose",
"UserForm",
"SharePointDocumentLocation",
"Queue",
"DuplicateRule",
"OpportunityClose",
"Workflow",
"RecurringAppointmentMaster",
"CustomerRelationship",
"Annotation",
"SharePointSite",
"ImportData",
"ImportFile",
"OrderClose",
"Contract",
"BulkOperation",
"CampaignResponse",
"Connection",
"Report",
"CampaignActivity",
"UserEntityUISettings",
"IncidentResolution",
"GoalRollupQuery",
"MailMergeTemplate",
"Campaign",
"PostFollow",
"ImportMap",
"Goal",
"AsyncOperation",
"ProcessSession",
"UserQuery",
"ActivityPointer",
"List",
"ServiceAppointment"};

     //A filter expression to limit entities returned to non-intersect, user-owned entities not found in the list of excluded entities.
     MetadataFilterExpression EntityFilter = new MetadataFilterExpression(LogicalOperator.And);
     EntityFilter.Conditions.Add(new MetadataConditionExpression("IsIntersect", MetadataConditionOperator.Equals, false));
     EntityFilter.Conditions.Add(new MetadataConditionExpression("OwnershipType", MetadataConditionOperator.Equals, OwnershipTypes.UserOwned));
     EntityFilter.Conditions.Add(new MetadataConditionExpression("SchemaName", MetadataConditionOperator.NotIn, excludedEntities));
     MetadataConditionExpression isVisibileInMobileTrue = new MetadataConditionExpression("IsVisibleInMobile", MetadataConditionOperator.Equals, true);
     EntityFilter.Conditions.Add(isVisibileInMobileTrue);

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.Metadata.Query Namespace
Retrieve and detect changes to metadata
Sample: Query metadata and detect changes

Return to top

Microsoft Dynamics 365

© 2016 Microsoft. All rights reserved. Copyright