transferOwnership method

Future<void> transferOwnership(
  1. String calendarId,
  2. String newDataOwner,
  3. bool useAdminAccess, {
  4. String? $fields,
})

Transfers a secondary calendar between users within a Google Workspace organization.

Requires user authentication with Manage Calendars administrator privilege, and one of the following authorization scopes:

Request parameters:

calendarId - Calendar identifier. To retrieve calendar IDs, call the calendarList.list method.

newDataOwner - The email address of a user who will become the data owner of the calendar.

useAdminAccess - When true, the method runs using the user's Google Workspace administrator privileges. The calling user must be a Google Workspace administrator with the Manage Calendars privilege. This method currently only supports admin access, thus only true is accepted for this field.

$fields - Selector specifying which fields to include in a partial response.

Completes with a commons.ApiRequestError if the API endpoint returned an error.

If the used http.Client completes with an error when making a REST call, this method will complete with the same error.

Implementation

async.Future<void> transferOwnership(
  core.String calendarId,
  core.String newDataOwner,
  core.bool useAdminAccess, {
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    'newDataOwner': [newDataOwner],
    'useAdminAccess': ['${useAdminAccess}'],
    'fields': ?$fields == null ? null : [$fields],
  };

  final url_ =
      'calendars/' +
      commons.escapeVariable('$calendarId') +
      '/transferOwnership';

  await _requester.request(
    url_,
    'POST',
    queryParams: queryParams_,
    downloadOptions: null,
  );
}