Share via


MessageTemplateClient.GetTemplates Method

Definition

Overloads

GetTemplates(String, CancellationToken)

List all templates for given ACS channel.

GetTemplates(Guid, Nullable<Int32>, RequestContext)

[Protocol Method] List all templates for given Azure Communication Services channel

GetTemplates(Guid, Nullable<Int32>, CancellationToken)

List all templates for given Azure Communication Services channel.

GetTemplates(String, CancellationToken)

Source:
MessageTemplateClient.cs

List all templates for given ACS channel.

public virtual Azure.Pageable<Azure.Communication.Messages.MessageTemplateItem> GetTemplates (string channelRegistrationId, System.Threading.CancellationToken cancellationToken = default);
abstract member GetTemplates : string * System.Threading.CancellationToken -> Azure.Pageable<Azure.Communication.Messages.MessageTemplateItem>
override this.GetTemplates : string * System.Threading.CancellationToken -> Azure.Pageable<Azure.Communication.Messages.MessageTemplateItem>
Public Overridable Function GetTemplates (channelRegistrationId As String, Optional cancellationToken As CancellationToken = Nothing) As Pageable(Of MessageTemplateItem)

Parameters

channelRegistrationId
String

The registration ID of the channel.

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Exceptions

The server returned an error. See Message for details returned from the server.

Applies to

GetTemplates(Guid, Nullable<Int32>, RequestContext)

Source:
MessageTemplateClient.cs

[Protocol Method] List all templates for given Azure Communication Services channel

public virtual Azure.Pageable<BinaryData> GetTemplates (Guid channelId, int? maxpagesize, Azure.RequestContext context);
abstract member GetTemplates : Guid * Nullable<int> * Azure.RequestContext -> Azure.Pageable<BinaryData>
override this.GetTemplates : Guid * Nullable<int> * Azure.RequestContext -> Azure.Pageable<BinaryData>
Public Overridable Function GetTemplates (channelId As Guid, maxpagesize As Nullable(Of Integer), context As RequestContext) As Pageable(Of BinaryData)

Parameters

channelId
Guid

The registration ID of the channel.

maxpagesize
Nullable<Int32>

Number of objects to return per page.

context
RequestContext

The request context, which can override default behaviors of the client pipeline on a per-call basis.

Returns

The Pageable<T> from the service containing a list of BinaryData objects. Details of the body schema for each item in the collection are in the Remarks section below.

Exceptions

Service returned a non-success status code.

Examples

This sample shows how to call GetTemplates and parse the result.

MessageTemplateClient client = new MessageTemplateClient((string)null);

foreach (BinaryData item in client.GetTemplates(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null, null))
{
    JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
    Console.WriteLine(result.GetProperty("name").ToString());
    Console.WriteLine(result.GetProperty("language").ToString());
    Console.WriteLine(result.GetProperty("status").ToString());
    Console.WriteLine(result.GetProperty("kind").ToString());
}

This sample shows how to call GetTemplates with all parameters and parse the result.

MessageTemplateClient client = new MessageTemplateClient((string)null);

foreach (BinaryData item in client.GetTemplates(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), 1234, null))
{
    JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
    Console.WriteLine(result.GetProperty("name").ToString());
    Console.WriteLine(result.GetProperty("language").ToString());
    Console.WriteLine(result.GetProperty("status").ToString());
    Console.WriteLine(result.GetProperty("kind").ToString());
}

Applies to

GetTemplates(Guid, Nullable<Int32>, CancellationToken)

Source:
MessageTemplateClient.cs

List all templates for given Azure Communication Services channel.

public virtual Azure.Pageable<Azure.Communication.Messages.MessageTemplateItem> GetTemplates (Guid channelId, int? maxpagesize = default, System.Threading.CancellationToken cancellationToken = default);
abstract member GetTemplates : Guid * Nullable<int> * System.Threading.CancellationToken -> Azure.Pageable<Azure.Communication.Messages.MessageTemplateItem>
override this.GetTemplates : Guid * Nullable<int> * System.Threading.CancellationToken -> Azure.Pageable<Azure.Communication.Messages.MessageTemplateItem>
Public Overridable Function GetTemplates (channelId As Guid, Optional maxpagesize As Nullable(Of Integer) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Pageable(Of MessageTemplateItem)

Parameters

channelId
Guid

The registration ID of the channel.

maxpagesize
Nullable<Int32>

Number of objects to return per page.

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Examples

This sample shows how to call GetTemplates.

MessageTemplateClient client = new MessageTemplateClient((string)null);

foreach (MessageTemplateItem item in client.GetTemplates(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")))
{
}

This sample shows how to call GetTemplates with all parameters.

MessageTemplateClient client = new MessageTemplateClient((string)null);

foreach (MessageTemplateItem item in client.GetTemplates(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), maxpagesize: 1234))
{
}

Applies to