Поскольку Филбурт покажет мне правильный путь, возможное C# решение находится внизу
public List<KeyValuePair<string, string>> GetRelatedEntities (string entityName)
{
List<KeyValuePair<string, string>> retval = new List<KeyValuePair<string, string>>();
RetrieveEntityRequest retrieveBankAccountEntityRequest = new RetrieveEntityRequest
{
EntityFilters = EntityFilters.All,
LogicalName = entityName
};
RetrieveEntityResponse retrieveBankAccountEntityResponse = (RetrieveEntityResponse)service.Execute(retrieveBankAccountEntityRequest);
OneToManyRelationshipMetadata[] relations = retrieveBankAccountEntityResponse.EntityMetadata.OneToManyRelationships;
foreach(OneToManyRelationshipMetadata m in relations)
{
retval.Add(new KeyValuePair<string, string>(m.ReferencingEntity, m.ReferencingAttribute));
}
return retval;
}