简体   繁体   English

在Dynamics CRM 2015 Online(C#)中访问扩展数据

[英]Access extension data in Dynamics CRM 2015 Online (C#)

So we have an extension for our projects in dynamics CRM which holds critical information for us to have other tools export and use to get further information. 因此,我们对Dynamics CRM中的项目进行了扩展,该扩展包含关键信息,以便我们导出其他工具并用于获取更多信息。

扩展图片

To loop through accounts and contacts I currently do 循环浏览我当前正在执行的帐户和联系人

IOrganizationService serviceA = (IOrganizationService)serviceProxy;
ServiceContext svcContext = new ServiceContext(serviceA);

//Loop through all accounts
foreach(var account in svcContext.AccountSet)
{
     Console.WriteLine(account.Name);
}

However how could I do this for projects and loop through that data? 但是,我该如何为项目执行此操作并遍历该数据?

Thanks. 谢谢。

You have to use serviceA.retrieveMultiple(query) message for retrieve either all records or purticular filter wise records. 您必须使用serviceA.retrieveMultiple(query)消息来检索所有记录或针状过滤器明智的记录。

query is like , QueryByAttribute or QueryExpression or fetchXML. 查询就像,QueryByAttribute或QueryExpression或fetchXML。

you are using Early Bound style, meaning you generated the classes using crmsvcutil.exe command line or a tool. 您正在使用Early Bound样式,这意味着您使用crmsvcutil.exe命令行或工具生成了类。

You will find your custom entity inside the context as well, so if the schema name of your entity is tsg_Project you can do 您还将在上下文中找到您的自定义实体,因此,如果您实体的架构名称为tsg_Project ,则可以执行此操作

foreach(var project in svcContext.tsg_ProjectSet)
{
     Console.WriteLine(project.tsg_Name);
}

pay attention that the generated classes use the schema name (where names can contains upper case or lower case letters) and not the logical name, where the names are all lower case. 请注意,生成的类使用架构名称(名称可以包含大写或小写字母)而不是逻辑名称(所有名称均为小写)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM