Споделяне чрез


UpdateAttributeRequest Class

Definition

Contains the data that is needed to update the definition of a column.

public ref class UpdateAttributeRequest sealed : Microsoft::Xrm::Sdk::OrganizationRequest
[System.Runtime.Serialization.DataContract(Namespace="http://schemas.microsoft.com/xrm/2011/Contracts")]
public sealed class UpdateAttributeRequest : Microsoft.Xrm.Sdk.OrganizationRequest
[<System.Runtime.Serialization.DataContract(Namespace="http://schemas.microsoft.com/xrm/2011/Contracts")>]
type UpdateAttributeRequest = class
    inherit OrganizationRequest
Public NotInheritable Class UpdateAttributeRequest
Inherits OrganizationRequest
Inheritance
UpdateAttributeRequest
Attributes

Examples

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 instance.

/// <summary>
/// Updates the display name of the specified column
/// </summary>
/// <param name="service">Authenticated IOrganizationService instance</param>
static void UpdateColumnExample(IOrganizationService service) {

      string tableLogicalName = "account";
      string columnLogicalName = "name";
      string newLabelValue = "Company Name";
      int languageCode = 1033; //English
      string solutionUniqueName = "SolutionName";

      RetrieveAttributeRequest retrieveRequest = new() { 
         EntityLogicalName = tableLogicalName,
         LogicalName = columnLogicalName
      };

      var retrieveResponse = (RetrieveAttributeResponse)service.Execute(retrieveRequest);

      // Just changing the Display Name in this example
      retrieveResponse.AttributeMetadata.DisplayName = new Label(newLabelValue, languageCode);

      UpdateAttributeRequest request = new() {
         EntityName = tableLogicalName,
         Attribute = retrieveResponse.AttributeMetadata,
         MergeLabels = true, 
         SolutionUniqueName = solutionUniqueName
      };

      service.Execute(request);        
}

Sample code on GitHub

Work with attribute metadata

Remarks

Usage

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

Privileges and Access Rights

To perform this action, the caller must have the System administrator or System customizer security roles.

Notes for Callers

For model-driven apps, you must publish the changes before they will be visible in the application. For more information, see Publish customizations.

Constructors

UpdateAttributeRequest()

Initializes a new instance of the UpdateAttributeRequest class.

Properties

Attribute

Gets or sets the attribute metadata to be updated. Required.

EntityName

Gets or sets the logical name of the entity to which the attribute belongs. Required.

ExtensionData

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

(Inherited from OrganizationRequest)
Item[String]

Gets or sets the indexer for the Parameters collection.

(Inherited from OrganizationRequest)
MergeLabels

Gets or sets whether the label metadata will be merged or overwritten. Required.

Parameters

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

(Inherited from OrganizationRequest)
RequestId

Gets or sets the ID of the request. Optional.

(Inherited from OrganizationRequest)
RequestName

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

(Inherited from OrganizationRequest)
SolutionUniqueName

Gets or sets the name of the solution to associate the entity with. Optional.

Applies to