Muzammil
Muzammil

Reputation: 21

Relationship Metadata in Dynamics 365

Is there a way to fetch relationship description in dynamics crm through C# ?

I have looked into OnetoManyMetadata object but could not find it anywhere.

Upvotes: 0

Views: 369

Answers (1)

Alex
Alex

Reputation: 23310

https://msdn.microsoft.com/en-us/library/microsoft.xrm.sdk.messages.retrieveentityrequest.aspx

var cl = new CrmServiceClient(...);
var q = new RetrieveEntityRequest { 
    EntityFilters = EntityFilters.Relationships, 
    LogicalName = "..." 
};
var r = (cl.Execute(q) as RetrieveEntityResponse).EntityMetadata;
var OtM = r.OneToManyRelationships;
var MtM = r.ManyToManyRelationships;
var MtO = r.ManyToOneRelationships;

Upvotes: 1

Related Questions