transferOwnership method
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:
- https://www.googleapis.com/auth/calendar
- https://www.googleapis.com/auth/calendar.calendars In the request, set useAdminAccess to true. The secondary calendar must be active to be transferred. Transferring disabled or deleted calendars isn't supported.
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,
);
}