简体   繁体   中英

How can I retrieve sections, tabs by using c# from MS dynamics CRM 2016?

I can retrieve attibutes by using code below:

    public static EntityMetadata RetrieveEntityMetadata(IOrganizationService service, string logicalName)
    {

        var request = new RetrieveEntityRequest()
        {
            LogicalName = logicalName,
            EntityFilters = EntityFilters.All,
            RetrieveAsIfPublished = false
        };
        var result = (RetrieveEntityResponse)service.Execute(request);
        return result.EntityMetadata;
    }

And result.EntityMetadata have a property Attributes , which contains all attributes of entity. But I want also get sections list of entity. How can I do this?

Sections and tabs are belongs to the form layout and not to the entity itself. There are different type of forms, and each type can have moe than one instance of the form (In case you'll have more than one main form, which should be taken?).

If you know exactly which form you need, than you should retrieve it as an entity of type systemform with field formxml , which contains XML template of the form. Parse that XML and you'll get the sections and tabs

在此输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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