Compartir por


UpdateRelationshipRequest Class

Definition

Contains the data that is needed to update the definition of an table relationship.

public ref class UpdateRelationshipRequest sealed : Microsoft::Xrm::Sdk::OrganizationRequest
[System.Runtime.Serialization.DataContract(Namespace="http://schemas.microsoft.com/xrm/2011/Contracts")]
public sealed class UpdateRelationshipRequest : Microsoft.Xrm.Sdk.OrganizationRequest
[<System.Runtime.Serialization.DataContract(Namespace="http://schemas.microsoft.com/xrm/2011/Contracts")>]
type UpdateRelationshipRequest = class
    inherit OrganizationRequest
Public NotInheritable Class UpdateRelationshipRequest
Inherits OrganizationRequest
Inheritance
UpdateRelationshipRequest
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 properties of a One-to-many relationship
/// </summary>
/// <param name="service">Authenticated IOrganizationService instance</param>
static void UpdateRelationshipExample(IOrganizationService service)
{
      string prefix = "sample";
      string relationshipName = $"{prefix}_Account_{prefix}_BankAccount";
      string newLabelValue = "Company";
      int languageCode = 1033; //English
      string solutionUniqueName = "SolutionName";

      RetrieveRelationshipRequest retrieveRequest = new()
      {
         Name = relationshipName
      };

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


      var relationship = (OneToManyRelationshipMetadata)retrieveResponse.RelationshipMetadata;

      // Change some relationship properties:
      relationship.AssociatedMenuConfiguration.Label = new Label(newLabelValue, languageCode);
      relationship.CascadeConfiguration.Share = CascadeType.UserOwned;
      relationship.CascadeConfiguration.Unshare = CascadeType.UserOwned;

      // Compose the request
      UpdateRelationshipRequest request = new()
      {
         Relationship = relationship,
         MergeLabels = true,
         SolutionUniqueName = solutionUniqueName
      };

      // Send the request
      service.Execute(request);
}         

Remarks

Usage

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

Privileges and Access Rights

To perform this action, the caller must have privileges listed in UpdateRelationship Privileges.

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

UpdateRelationshipRequest()

Initializes a new instance of the UpdateRelationshipRequest class.

Properties

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 to merge the new labels with any existing labels. Required.

Parameters

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

(Inherited from OrganizationRequest)
Relationship

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

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 unique name of the unmanaged solution that this table relationship should be associated with. Optional.

Applies to