CreateManyToManyRequest Class


Updated: November 29, 2016

Applies To: Dynamics 365 (online), Dynamics 365 (on-premises), Dynamics CRM 2016, Dynamics CRM Online

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

Namespace:   Microsoft.Xrm.Sdk.Messages
Assembly:  Microsoft.Xrm.Sdk (in Microsoft.Xrm.Sdk.dll)


<DataContractAttribute(Namespace := "")>
Public NotInheritable Class CreateManyToManyRequest
	Inherits OrganizationRequest


Initializes a new instance of the CreateManyToManyRequest class.


Gets or sets the structure that contains extra data. Optional.(Inherited from OrganizationRequest.)


Gets or sets the name of the intersect entity to be created for this entity relationship. Required.


Gets or sets the indexer for the Parameters collection.(Inherited from OrganizationRequest.)


Gets or sets the definition of the Many-to-Many entity relationship to be created. Required.


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 an asynchronous operation (system job). 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 you want to add this many-to-many entity relationship to. Optional.


(Inherited from Object.)


(Inherited from Object.)


(Inherited from Object.)


(Inherited from Object.)

Message Availability

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


Pass an instance of this class to the Execute method, which returns an instance of CreateManyToManyResponse.

Privileges and Access Rights

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

Notes for Callers

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 the entity relationship between the Account and Contact entities by using CreateManyToManyRequest.

Dim accountEligibleParticipate As Boolean = EligibleCreateManyToManyRelationship("account")
Dim campaignEligibleParticipate As Boolean = EligibleCreateManyToManyRelationship("campaign")

If accountEligibleParticipate AndAlso campaignEligibleParticipate Then

 Dim createManyToManyRelationshipRequest As CreateManyToManyRequest =
  New CreateManyToManyRequest With {
   .IntersectEntitySchemaName = "new_accounts_campaigns",
   .ManyToManyRelationship = New ManyToManyRelationshipMetadata With {
    .SchemaName = "new_accounts_campaigns",
    .Entity1LogicalName = "account",
    .Entity1AssociatedMenuConfiguration =
    New AssociatedMenuConfiguration With {
     .Behavior = AssociatedMenuBehavior.UseLabel,
     .Group = AssociatedMenuGroup.Details,
     .Label = New Label("Account", 1033),
     .Order = 10000
    .Entity2LogicalName = "campaign",
    .Entity2AssociatedMenuConfiguration =
    New AssociatedMenuConfiguration With {
     .Behavior = AssociatedMenuBehavior.UseLabel,
     .Group = AssociatedMenuGroup.Details,
     .Label = New Label("Campaign", 1033),
     .Order = 10000

 Dim createManytoManyRelationshipResponse As CreateManyToManyResponse =
  CType(_serviceProxy.Execute(createManyToManyRelationshipRequest), CreateManyToManyResponse)

 _manyToManyRelationshipId = createManytoManyRelationshipResponse.ManyToManyRelationshipId
 _manyToManyRelationshipName = createManyToManyRelationshipRequest.ManyToManyRelationship.SchemaName

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

Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top

Microsoft Dynamics 365

© 2016 Microsoft. All rights reserved. Copyright

Community Additions