// ** Create a integer attribute **
IntegerAttributeMetadata integerAttribute = new IntegerAttributeMetadata
{
// Set base properties
SchemaName = "new_integer",
DisplayName = new Label("Sample Integer", 1033),
RequiredLevel = new AttributeRequiredLevelManagedProperty(AttributeRequiredLevel.None),
Description = new Label("Integer Attribute", 1033),
// Set extended properties
Format = IntegerFormat.None,
MaxValue = 100,
MinValue = 0
};
// Create the request.
CreateAttributeRequest createAttributeRequest = new CreateAttributeRequest
{
EntityName = "EntityLogicalName",
Attribute = integerAttribute
};
// Execute the request. Get Response
CreateAttributeResponse resp = (CreateAttributeResponse)_service.Execute(createAttributeRequest);