CreateAttributeRequest Class


Contains the data that is needed to create a new attribute, and optionally, to add it to a specified unmanaged solution.

public ref class CreateAttributeRequest sealed : Microsoft::Xrm::Sdk::OrganizationRequest
public sealed class CreateAttributeRequest : Microsoft.Xrm.Sdk.OrganizationRequest
type CreateAttributeRequest = class
    inherit OrganizationRequest
Public NotInheritable Class CreateAttributeRequest
Inherits OrganizationRequest


The following example shows how to use this message. For this sample to work correctly, you must be connected to the server to get an IOrganizationService interface. For the complete sample, see the link later in this topic.

This code defines the AttributeMetadata for a number of different types of attributes and adds them to a List<AttributeMetadata>. At the end of the code, the CreateAttributeRequest class prepares the request, and the attribute is created by using the Execute(OrganizationRequest) method.

This code sample assumes that the current customization prefix is ‘new’ because that is the default customization prefix for the organization solution publisher. You should use the customization prefix for the solution publisher that makes sense for the solution context in which you work.



Pass an instance of this class to the Execute(OrganizationRequest) method, which returns an instance of the CreateAttributeResponse class.

Privileges and Access Rights

To perform this action, the caller must have the required privileges, as listed in CreateAttribute message privileges.

Notes for Callers

This message cannot be used to create a LookupAttributeMetadata attribute or a customer lookup attribute. Use the CreateOneToManyRequest message to create a lookup attribute and the CreateCustomerRelationshipsRequest message to create a customer lookup attribute.

Supported Entities

You can only add attributes to customizable entities where the managed property CanCreateAttributes is true.



Initializes a new instance of the CreateAttributeRequest class.



Gets or sets the definition of the attribute type that you want to create. Required.


Gets or sets the name of the entity for which you want to create an attribute. Required.


Gets or sets the structure that contains extra data. Optional.

(Inherited from OrganizationRequest)

Gets or sets the indexer for the Parameters collection.

(Inherited from OrganizationRequest)

Gets or sets the collection of parameters for the request. Required, but is supplied by derived classes.

(Inherited from OrganizationRequest)

Gets or sets the ID of the request. Optional.

(Inherited from OrganizationRequest)

Gets or sets the name of the request. Required, but is supplied by derived classes.

(Inherited from OrganizationRequest)

Gets or sets the name of the unmanaged solution to which you want to add this attribute. Optional.

Applies to

See also