Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

OrganizationServiceContext.AddRelatedObject Method

Definition

Namespace:
Microsoft.Xrm.Sdk.Client
Assembly:
Microsoft.Xrm.Sdk.dll
Package:
Microsoft.PowerPlatform.Dataverse.Client v1.2.10

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Adds a related entity to the OrganizationServiceContext and creates the link that defines the relationship between the two entities in a single request.

public:
 void AddRelatedObject(Microsoft::Xrm::Sdk::Entity ^ source, Microsoft::Xrm::Sdk::Relationship ^ relationship, Microsoft::Xrm::Sdk::Entity ^ target);
public void AddRelatedObject(Microsoft.Xrm.Sdk.Entity source, Microsoft.Xrm.Sdk.Relationship relationship, Microsoft.Xrm.Sdk.Entity target);
member this.AddRelatedObject : Microsoft.Xrm.Sdk.Entity * Microsoft.Xrm.Sdk.Relationship * Microsoft.Xrm.Sdk.Entity -> unit
Public Sub AddRelatedObject (source As Entity, relationship As Relationship, target As Entity)

Parameters

source
Entity

The parent entity that is being tracked by the context.

relationship
Relationship

The name of the attribute or navigation property that returns the related object based on an association between the two entities.

target
Entity

The related object that is being added.

Remarks

This method essentially works by calling AddObject(Entity) and AddLink(Entity, Relationship, Entity).

Applies to