ConversationThreadClient.GetConversations Method
Definition
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.
Overloads
GetConversations(Nullable<Int32>, String, Nullable<Guid>, RequestContext) |
[Protocol Method] Retrieves list of conversations.
|
GetConversations(Nullable<Int32>, String, Nullable<Guid>, CancellationToken) |
Retrieves list of conversations. |
GetConversations(Nullable<Int32>, String, Nullable<Guid>, RequestContext)
- Source:
- ConversationThreadClient.cs
[Protocol Method] Retrieves list of conversations.
- This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
- Please try the simpler GetConversations(Nullable<Int32>, String, Nullable<Guid>, CancellationToken) convenience overload with strongly typed models first.
public virtual Azure.Pageable<BinaryData> GetConversations(int? maxPageSize, string participantId, Guid? channelId, Azure.RequestContext context);
abstract member GetConversations : Nullable<int> * string * Nullable<Guid> * Azure.RequestContext -> Azure.Pageable<BinaryData>
override this.GetConversations : Nullable<int> * string * Nullable<Guid> * Azure.RequestContext -> Azure.Pageable<BinaryData>
Public Overridable Function GetConversations (maxPageSize As Nullable(Of Integer), participantId As String, channelId As Nullable(Of Guid), context As RequestContext) As Pageable(Of BinaryData)
Parameters
- participantId
- String
The participant user ID.
- 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 GetConversations and parse the result.
Uri endpoint = new Uri("<endpoint>");
TokenCredential credential = new DefaultAzureCredential();
ConversationThreadClient client = new ConversationThreadClient(endpoint, credential);
foreach (BinaryData item in client.GetConversations(null, null, null, null))
{
JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
Console.WriteLine(result.GetProperty("id").ToString());
}
This sample shows how to call GetConversations with all parameters and parse the result.
Uri endpoint = new Uri("<endpoint>");
TokenCredential credential = new DefaultAzureCredential();
ConversationThreadClient client = new ConversationThreadClient(endpoint, credential);
foreach (BinaryData item in client.GetConversations(1234, "<participantId>", Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null))
{
JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
Console.WriteLine(result.GetProperty("id").ToString());
Console.WriteLine(result.GetProperty("topic").ToString());
Console.WriteLine(result.GetProperty("deliveryChannelIds")[0].ToString());
Console.WriteLine(result.GetProperty("outboundDeliveryStrategy").ToString());
Console.WriteLine(result.GetProperty("participants")[0].GetProperty("id").ToString());
Console.WriteLine(result.GetProperty("participants")[0].GetProperty("displayName").ToString());
Console.WriteLine(result.GetProperty("participants")[0].GetProperty("kind").ToString());
}
Applies to
GetConversations(Nullable<Int32>, String, Nullable<Guid>, CancellationToken)
- Source:
- ConversationThreadClient.cs
Retrieves list of conversations.
public virtual Azure.Pageable<Azure.Communication.Messages.CommunicationConversation> GetConversations(int? maxPageSize = default, string participantId = default, Guid? channelId = default, System.Threading.CancellationToken cancellationToken = default);
abstract member GetConversations : Nullable<int> * string * Nullable<Guid> * System.Threading.CancellationToken -> Azure.Pageable<Azure.Communication.Messages.CommunicationConversation>
override this.GetConversations : Nullable<int> * string * Nullable<Guid> * System.Threading.CancellationToken -> Azure.Pageable<Azure.Communication.Messages.CommunicationConversation>
Public Overridable Function GetConversations (Optional maxPageSize As Nullable(Of Integer) = Nothing, Optional participantId As String = Nothing, Optional channelId As Nullable(Of Guid) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Pageable(Of CommunicationConversation)
Parameters
- participantId
- String
The participant user ID.
- cancellationToken
- CancellationToken
The cancellation token to use.
Returns
Examples
This sample shows how to call GetConversations.
Uri endpoint = new Uri("<endpoint>");
TokenCredential credential = new DefaultAzureCredential();
ConversationThreadClient client = new ConversationThreadClient(endpoint, credential);
foreach (CommunicationConversation item in client.GetConversations())
{
}
This sample shows how to call GetConversations with all parameters.
Uri endpoint = new Uri("<endpoint>");
TokenCredential credential = new DefaultAzureCredential();
ConversationThreadClient client = new ConversationThreadClient(endpoint, credential);
foreach (CommunicationConversation item in client.GetConversations(maxPageSize: 1234, participantId: "<participantId>", channelId: Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")))
{
}