Share via


DigitalTwinsClient.GetIncomingRelationshipsAsync Method

Definition

Gets all the relationships referencing a digital twin as a target by iterating through a collection asynchronously.

public virtual Azure.AsyncPageable<Azure.DigitalTwins.Core.IncomingRelationship> GetIncomingRelationshipsAsync (string digitalTwinId, System.Threading.CancellationToken cancellationToken = default);
abstract member GetIncomingRelationshipsAsync : string * System.Threading.CancellationToken -> Azure.AsyncPageable<Azure.DigitalTwins.Core.IncomingRelationship>
override this.GetIncomingRelationshipsAsync : string * System.Threading.CancellationToken -> Azure.AsyncPageable<Azure.DigitalTwins.Core.IncomingRelationship>
Public Overridable Function GetIncomingRelationshipsAsync (digitalTwinId As String, Optional cancellationToken As CancellationToken = Nothing) As AsyncPageable(Of IncomingRelationship)

Parameters

digitalTwinId
String

The Id of the target digital twin.

cancellationToken
CancellationToken

The cancellation token.

Returns

The pageable list AsyncPageable<T> of application/json relationships directed towards the specified digital twin and the HTTP response.

Exceptions

The exception that captures the errors from the service. Check the ErrorCode and Status properties for more details.

The exception is thrown when digitalTwinId is null.

Examples

AsyncPageable<IncomingRelationship> incomingRelationships = client.GetIncomingRelationshipsAsync("buildingTwinId");

await foreach (IncomingRelationship incomingRelationship in incomingRelationships)
{
    Console.WriteLine($"Found an incoming relationship '{incomingRelationship.RelationshipId}' from '{incomingRelationship.SourceId}'.");
}

Remarks

For more samples, see our repo samples.

Applies to

See also