다음을 통해 공유


DeviceManagementClient.GetGroupAsync(String, RequestContext) Method

Definition

Gets the device group properties.

public virtual System.Threading.Tasks.Task<Azure.Response> GetGroupAsync (string groupId, Azure.RequestContext context = default);
abstract member GetGroupAsync : string * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.GetGroupAsync : string * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function GetGroupAsync (groupId As String, Optional context As RequestContext = Nothing) As Task(Of Response)

Parameters

groupId
String

Group identifier.

context
RequestContext

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

Returns

The response returned from the service. Details of the response body schema are in the Remarks section below.

Exceptions

groupId is null.

groupId is an empty string, and was expected to be non-empty.

Service returned a non-success status code.

Examples

This sample shows how to call GetGroupAsync with required parameters and parse the result.

var credential = new DefaultAzureCredential();
var endpoint = new Uri("<https://my-service.azure.com>");
var client = new DeviceManagementClient(endpoint, "<instanceId>", credential);

Response response = await client.GetGroupAsync("<groupId>");

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("groupId").ToString());
Console.WriteLine(result.GetProperty("groupType").ToString());
Console.WriteLine(result.GetProperty("createdDateTime").ToString());
Console.WriteLine(result.GetProperty("deviceCount").ToString());
Console.WriteLine(result.GetProperty("subgroupsWithNewUpdatesAvailableCount").ToString());
Console.WriteLine(result.GetProperty("subgroupsWithUpdatesInProgressCount").ToString());
Console.WriteLine(result.GetProperty("subgroupsWithOnLatestUpdateCount").ToString());
Console.WriteLine(result.GetProperty("deployments")[0].ToString());

Remarks

Below is the JSON schema for the response payload.

Response Body:

Schema for Group:

{
              groupId: string, # Required. Group identity. This is created from the value of the ADUGroup tag in the Iot Hub's device/module twin or $default for devices with no tag.
              groupType: "IoTHubTag" | "DefaultNoTag", # Required. Group type.
              createdDateTime: string, # Required. Date and time when the update was created.
              deviceCount: number, # Optional. The number of devices in the group.
              subgroupsWithNewUpdatesAvailableCount: number, # Optional. The count of subgroups with new updates available.
              subgroupsWithUpdatesInProgressCount: number, # Optional. The count of subgroups with updates in progress.
              subgroupsWithOnLatestUpdateCount: number, # Optional. The count of subgroups with devices on the latest update.
              deployments: [string], # Optional. The active deployment Ids for the group
            }

Applies to