Dynamics CRM如何获取所有实体的列表 [英] Dynamics CRM how to get list of all entities

查看:204
本文介绍了Dynamics CRM如何获取所有实体的列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用CRM 2013,如何通过 connectionManager 类获取CRM中所有实体的列表?我想获取当前连接的所有实体。

Working with CRM 2013, how can I get a list of all entities in the CRM via the connectionManager class? I want to get all the entities for the current connection.

推荐答案

感谢您的评论和现在就回答它的工作,
这是我的功能

Thank you for your comment and answer it work now, this is my function

public static EntityMetadata[] GetEntities ( IOrganizationService organizationService)
{
    Dictionary<string, string> attributesData = new Dictionary<string, string>();
    RetrieveAllEntitiesRequest metaDataRequest = new RetrieveAllEntitiesRequest();
    RetrieveAllEntitiesResponse metaDataResponse = new RetrieveAllEntitiesResponse();
    metaDataRequest.EntityFilters = EntityFilters.Entity;

    // Execute the request.

    metaDataResponse = (RetrieveAllEntitiesResponse)organizationService.Execute(metaDataRequest);

    var entities = metaDataResponse.EntityMetadata;

    return entities;
}

我在Windows应用程序窗体中这样调用函数:

and i call my function in the windows app form like this:

var allEntities = CRMHelpers.GetEntities(service);
foreach (EntityMetadata Entity in allEntities)
{
    cbxEntity.Items.Add(Entity.LogicalName);
}

这篇关于Dynamics CRM如何获取所有实体的列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆