MSCRM Bing'd

Informative and Technical

  • Home
  • About
Posts Comments
  • MS CRM
    • MS CRM 2011
  • Information
  • Dynamics XRM Tools

CRM 2011 Metadata Query Enhancements

January 11, 2013 Leave a comment

Rollup 12 (CRM December 2012 Service Update),  is full of nice new features but a huge bonus was the new capabilities to interact with CRM metadata in a much more efficient manner along with benefiting from improved performance. Only retrieving the metadata that you only require and need is a much more pleasing idea especially when it comes to mobile clients.  The MSDN SDK article can be found here that covers this subject in more detail. http://msdn.microsoft.com/en-us/library/jj863599.aspx

The following classes offer this new functionality

  • Microsoft.Xrm.Sdk.Metadata.Query
  • RetrieveMetadataChangesRequest (Microsoft.Xrm.Sdk.Messages)
  • RetrieveMetadataChangesResponse (Microsoft.Xrm.Sdk.Messages)

Prior to Rollup 12 you could use RetrieveEntityRequest or RetrieveAllEntitiesRequest in the Microsoft.Xrm.Sdk.Messages namespace but were limited to the amount of query filters so when you queried for entity data you essentially received more than sometimes necessary. You can see the EntityFilters enumeration here http://msdn.microsoft.com/en-us/library/microsoft.xrm.sdk.metadata.entityfilters.aspx

Filters Description
All Use this to retrieve all data for an entity. Value = 15.
Attributes Use this to retrieve entity information plus attributes for the entity. Value = 2.
Default Use this to retrieve only entity information. Equivalent to EntityFilters.Entity . Value = 1.
Entity Use this to retrieve only entity information. Equivalent to EntityFilters.Default . Value = 1.
Privileges Use this to retrieve entity information plus privileges for the entity. Value = 4.
Relationships Use this to retrieve entity information plus entity relationships for the entity. Value = 8.

RetrieveEntityRequest retrieveRequest = new RetrieveEntityRequest
{
EntityFilters = EntityFilters.Entity,
LogicalName = _customEntityName
};
RetrieveEntityResponse retrieveEntityResponse = (RetrieveEntityResponse)orgService.Execute(retrieveRequest);

As you can imagine if you only want to check if an entity has Is Visible in Mobile flag set then you don’t want anything else. In this case the new EntityQueryExpression class provides a similar experience to the existing QueryExpression for querying CRM  data though specifically for querying metadata.

New metadata query classes include

Class Description
AttributeQueryExpression Defines a complex query to retrieve attribute metadata for entities retrieved using an EntityQueryExpression
DeletedMetadataCollection The structure used to return deleted metadata.
EntityQueryExpression Defines a complex query to retrieve entity metadata.
LabelQueryExpression Defines the languages for the labels to be retrieved for metadata items that have labels.
MetadataConditionExpression Contains a condition expression used to filter the results of the metadata query.
MetadataFilterExpression Specifies complex condition and logical filter expressions used for filtering the results of a metadata query.
MetadataPropertiesExpression Specifies the properties for which non-null values are returned from a query.
MetadataQueryBase Represents the abstract base class for constructing a metadata query.
MetadataQueryExpression Represents the abstract base class for constructing a metadata query.
RelationshipQueryExpression Defines a complex query to retrieve entity relationship metadata for entities retrieved using an EntityQueryExpression

So to slightly different but if you want to retrieve all entities that have the Is Visible in Mobile set to true using the new classes then specify a filter as follows and execute the RetrieveMetadataChangesRequest message with ClientVersionStamp set to null in the request.

MetadataFilterExpression entityFilter = new MetadataFilterExpression(LogicalOperator.And);
EntityFilter.Conditions.Add(new MetadataConditionExpression("IsVisibleInMobile", MetadataConditionOperator.Equals, true);
EntityQueryExpression entityQueryExpression = new EntityQueryExpression()
{
Criteria = entityFilter
};
RetrieveMetadataChangesRequest retrieveMetadataChangesRequest = new RetrieveMetadataChangesRequest()
{
Query = entityQueryExpression,
ClientVersionStamp = null
};
RetrieveMetadataChangesResponse response = (RetrieveMetadataChangesResponse)orgService.Execute(retrieveMetadataChangesRequest);

The ClientVersionStamp timestamp value representing when the last request was made can be set to only retrieve data that has changed since the time specified.  The RetrieveMetadataChangesResponse returns a timestamp value that can be used with another request at a later time to return information about how metadata has changed since the last request.

This article only scratches the surface of this awesome and long awaited feature so if you want to come up to speed have a read over the SDK article Retrieve and Detect Changes to Metadata.

Filed under Information, MS CRM, MS CRM 2011 Tagged with ClientVersionStamp, CRM 2011, EntityQueryExpression, Metadata, Microsoft Dynamics CRM 2011, Microsoft.Xrm.Sdk.Metadata.Query, MSCRM, MSCRM 2011, Query, RetrieveAllEntitiesRequest, RetrieveEntity, RetrieveMetadataChangesRequest, RetrieveMetadataChangesResponse, Rollup 12, SDK

CRM 2011 Metadata Browser – Export to Excel

June 27, 2011 4 Comments

This project is superceded by the new application Dynamics XRM Tools which includes improved features http://dynamicsxrmtools.codeplex.com/

 

New Export to Excel feature added to the CRM 2011 Metadata Browser.

Export your entities, attributes and relationships in either xml (MS Excel) or csv fomat.

Summary

I developed the CRM 2011 Metadata Browser as a Silverlight 4 application that is packaged as a Managed CRM 2011 Solution. This tool allows you to view metadata within CRM including Entities, Attributes and Relationships. The tool uses the 2011 endpoint Organization.svc/web WCF service and is accessible from the Settings area under Customizations in CRM once imported into CRM.

You can download the CRM 2011 Metadata Browser from codeplex.

Filed under MS CRM, MS CRM 2011 Tagged with Browser, CRM, CRM 2011, Custom Application, Export to Excel, Metadata, Microsoft Dynamics CRM 2011, MSCRM, MSCRM 2011, online, Organization.svc

CRM 2011 Metadata Browser

February 18, 2011 8 Comments

This project is superceded by the new application Dynamics XRM Tools which includes improved features http://dynamicsxrmtools.codeplex.com/

 

I’ve developed the  CRM 2011 Metadata Browser as a Silverlight 4 application that is packaged as a Managed CRM 2011 Solution. This tool allows you to view metadata within CRM including Entities, Attributes and Relationships. The tool uses the 2011 endpoint Organization.svc/web WCF service and is accessible from the Settings area under Customizations in CRM once imported into CRM.

You can download the CRM 2011 Metadata Browser from codeplex.

CRM 2011 Metadata Browser

Metadata Browser Menu Option

The look and feel of this component will improve and new functionality will be added in the near future so please provide feedback on your experience.

Filed under MS CRM, MS CRM 2011 Tagged with Browser, CRM 2011, download, Managed, Metadata, Microsoft Application Framework, Microsoft Dynamics CRM 2011, MSCRM, MSCRM 2011, Organization.svc, SDK, SOAP, Solution, XRM

MVP
MCCA

Links

  • CRM Connection
  • Microsoft Dynamics CRM Forum
  • Microsoft Dynamics CRM Online Team Blog
  • Microsoft Dynamics CRM Team Blog

RSS CRM Team Blog

  • RELEASE: ALM for Microsoft Dynamics CRM 2011: CRM Solution Lifecycle Management
  • Dynamics CRM 2011 IG Update V5.9 May 2013
  • Using Power View in Excel 2013 to Analyze CRM Data
  • Creating and Publishing a Web Portal to an Azure Cloud Service
  • How to build and run the Dynamics CRM SDK samples on Windows Server 2012 and Windows 8
Locations of visitors to this page

Archives

  • January 2013
  • October 2012
  • August 2012
  • July 2012
  • June 2012
  • May 2012
  • March 2012
  • February 2012
  • January 2012
  • December 2011
  • November 2011
  • October 2011
  • September 2011
  • August 2011
  • June 2011
  • May 2011
  • April 2011
  • March 2011
  • February 2011
  • January 2011
  • December 2010
  • November 2010
  • October 2010
  • September 2010
  • August 2010
  • July 2010
  • June 2010
  • May 2010
  • April 2010
  • March 2010
  • February 2010

Tags

Beta Bing'd Bing Maps Book CRM CRM 4 CRM 5 CRM 2011 Custom Application Demo download Error Message Event Javascript King of Bing Live Meeting Metadata Microsoft Application Framework Microsoft Dynamics CRM 2011 MSCRM MSCRM 2011 MSCRM Platform MSDN Multi Browser MVP OData online Organization.svc Outlook Client REST Rhett Clinton Rollup 9 Rollup 10 Rollup 11 Rollup 12 SDK Search Server Silverlight SOAP Support Timeout Tool Updates XRM

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 283 other followers

Get RSS Feeds

RSS Feed RSS - Posts

RSS Feed RSS - Comments

Top Posts

  • CRM 2011 Discovery and Web Service URLs
  • Default Customer Lookup to Contact in CRM 2011
  • Set Lookup Value using JavaScript Tip
  • CRM 2011 Client Diagnostics Tool for On Premise
  • CRM 2011 OData Query Designer
  • Accessing the Parent Form Xrm.Page in CRM 2011
  • CRM 2011 Grid with Preview Form
  • Support with CRM 2011, Windows 8, IE 10 and Office 2013
  • Microsoft Dynamics CRM 2011 - Hide Areas of a Form
  • CRM 4 to CRM 2011 JavaScript Converter Tool

Blog at WordPress.com.

Theme: Enterprise by StudioPress.