public Microsoft365Group GetDeletedGroup(HttpClient httpClient, string accessToken) { if (_group != null) { return Microsoft365GroupsUtility.GetDeletedGroupAsync(httpClient, _group.Id.Value, accessToken).GetAwaiter().GetResult(); } else if (_groupId != Guid.Empty) { return Microsoft365GroupsUtility.GetDeletedGroupAsync(httpClient, _groupId, accessToken).GetAwaiter().GetResult(); } else if (!string.IsNullOrEmpty(_displayName)) { return Microsoft365GroupsUtility.GetDeletedGroupAsync(httpClient, _displayName, accessToken).GetAwaiter().GetResult(); } return null; }
public Guid GetDeletedGroupId(HttpClient httpClient, string accessToken) { if (_group != null) { return _group.Id.Value; } else if (_groupId != Guid.Empty) { return _groupId; } else if (!string.IsNullOrEmpty(_displayName)) { var group = Microsoft365GroupsUtility.GetDeletedGroupAsync(httpClient, _displayName, accessToken).GetAwaiter().GetResult(); if (group != null) { return group.Id.Value; } } throw new PSInvalidOperationException("Deleted group not found"); }