繁体   English   中英

如何通过API在CRM Dynamics中创建自定义实体本身

[英]How to create custom entity itself in CRM Dynamics via API

有没有办法我可以连接到CRM动态并创建自定义实体本身。 在API中,我将传递创建自定义实体所需的实体名称,字段,数据类型等详细信息。

我想使用C#进行API调用。

是。 您需要使用元数据服务。

样本:创建和更新实体元数据

CreateEntityRequest createrequest = new CreateEntityRequest
{

    //Define the entity
    Entity = new EntityMetadata
    {
        SchemaName = _customEntityName,
        DisplayName = new Label("Bank Account", 1033),
        DisplayCollectionName = new Label("Bank Accounts", 1033),
        Description = new Label("An entity to store information about customer bank accounts", 1033),
        OwnershipType = OwnershipTypes.UserOwned,
        IsActivity = false,

    },

    // Define the primary attribute for the entity
    PrimaryAttribute = new StringAttributeMetadata
    {
        SchemaName = "new_accountname",
        RequiredLevel = new AttributeRequiredLevelManagedProperty(AttributeRequiredLevel.None),
        MaxLength = 100,
        FormatName = StringFormatName.Text,
        DisplayName = new Label("Account Name", 1033),
        Description = new Label("The primary attribute for the Bank Account entity.", 1033)
    }

};
_serviceProxy.Execute(createrequest);

暂无
暂无

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

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