CreateOneToManyRequest CreateOneToManyRequest CreateOneToManyRequest CreateOneToManyRequest Class

Definition

Contains the data that is needed to create a new One-to-Many (1:N) entity relationship.

public ref class CreateOneToManyRequest sealed : Microsoft::Xrm::Sdk::OrganizationRequest
[System.Runtime.Serialization.DataContract(Namespace="http://schemas.microsoft.com/xrm/2011/Contracts")]
public sealed class CreateOneToManyRequest : Microsoft.Xrm.Sdk.OrganizationRequest
type CreateOneToManyRequest = class
    inherit OrganizationRequest
Public NotInheritable Class CreateOneToManyRequest
Inherits OrganizationRequest
Inheritance
CreateOneToManyRequestCreateOneToManyRequestCreateOneToManyRequestCreateOneToManyRequest
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. This sample creates an entity relationship between Account and Campaign entities by using CreateOneToManyRequest.

// create one to many
bool eligibleCreateOneToManyRelationship =EligibleCreateOneToManyRelationship("account", "campaign");

if (eligibleCreateOneToManyRelationship) { CreateOneToManyRequest createOneToManyRelationshipRequest = new CreateOneToManyRequest { OneToManyRelationship = new OneToManyRelationshipMetadata { ReferencedEntity = "account", ReferencingEntity = "campaign", SchemaName = "new_account_campaign", AssociatedMenuConfiguration = new AssociatedMenuConfiguration { Behavior = AssociatedMenuBehavior.UseLabel, Group = AssociatedMenuGroup.Details, Label = new Label("Account", 1033), Order = 10000 }, CascadeConfiguration = new CascadeConfiguration { Assign = CascadeType.NoCascade, Delete = CascadeType.RemoveLink, Merge = CascadeType.NoCascade, Reparent = CascadeType.NoCascade, Share = CascadeType.NoCascade, Unshare = CascadeType.NoCascade } }, Lookup = new LookupAttributeMetadata { SchemaName = "new_parent_accountid", DisplayName = new Label("Account Lookup", 1033), RequiredLevel = new AttributeRequiredLevelManagedProperty(AttributeRequiredLevel.None), Description = new Label("Sample Lookup", 1033) } };

CreateOneToManyResponse createOneToManyRelationshipResponse =(CreateOneToManyResponse)svc.Execute(createOneToManyRelationshipRequest); _oneToManyRelationshipId =createOneToManyRelationshipResponse.RelationshipId; _oneToManyRelationshipName = createOneToManyRelationshipRequest.OneToManyRelationship.SchemaName;

Console.WriteLine("The one-to-many relationship has been created between {0} and {1}.","account", "campaign"); }

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 sample creates an entity relationship between Account and Campaign entities by using CreateOneToManyRequest.

Relationships#WorkWithRelationships1 RelationshipsVB#WorkWithRelationships1

Remarks

Message Availability

For this message to work, the caller must be connected to the server.

Usage

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

Privileges and Access Rights

To perform this action, the caller must have privileges listed in CreateOneToMany message privileges.

Notes for Callers

Constructors

CreateOneToManyRequest() CreateOneToManyRequest() CreateOneToManyRequest() CreateOneToManyRequest()

Initializes a new instance of the CreateOneToManyRequest class.

Properties

ExtensionData ExtensionData ExtensionData ExtensionData

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

(Inherited from OrganizationRequest)
Item[String] Item[String] Item[String] Item[String]

Gets or sets the indexer for the Parameters collection.

(Inherited from OrganizationRequest)
Lookup Lookup Lookup Lookup

Gets or sets the metadata for the lookup field used to store the ID of the related record. Required.

OneToManyRelationship OneToManyRelationship OneToManyRelationship OneToManyRelationship

Gets or sets the metadata for the relationship. Required.

Parameters Parameters Parameters Parameters

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

(Inherited from OrganizationRequest)
RequestId RequestId RequestId RequestId

Gets or sets the ID of an asynchronous operation (system job). Optional.

(Inherited from OrganizationRequest)
RequestName RequestName RequestName RequestName

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

(Inherited from OrganizationRequest)
SolutionUniqueName SolutionUniqueName SolutionUniqueName SolutionUniqueName

Gets or sets the name of the unmanaged solution you want to add this one-to-Many entity relationship to. Optional.

Applies to

See also