다음을 통해 공유


DeviceManagementClient.DeleteGroup(String, RequestContext) Method

Definition

Deletes a device group. This group is automatically created when a Device Update-enabled device is connected to the hub and reports its properties. Groups, subgroups, and deployments are not automatically cleaned up but are retained for history purposes. Users can call this method to delete a group if they do not need to retain any of the history of the group and no longer need it. If a device is ever connected again for this group after the group was deleted it will be automatically re-created but there will be no history.

public virtual Azure.Response DeleteGroup (string groupId, Azure.RequestContext context = default);
abstract member DeleteGroup : string * Azure.RequestContext -> Azure.Response
override this.DeleteGroup : string * Azure.RequestContext -> Azure.Response
Public Overridable Function DeleteGroup (groupId As String, Optional context As RequestContext = Nothing) As 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.

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 DeleteGroup with required parameters.

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

Response response = client.DeleteGroup("<groupId>");
Console.WriteLine(response.Status);

Remarks

Schema for Response Error:

{
              error: {
                code: string,
                message: string,
                target: string,
                details: [Error],
                innererror: {
                  code: string,
                  message: string,
                  errorDetail: string,
                  innerError: InnerError
                },
                occurredDateTime: string (ISO 8601 Format)
              }
            }

Applies to