Skip to content

Powershell code sample

robertj edited this page Sep 14, 2010 · 8 revisions

creating user accounts:

$UserService = New-GDataUserService -AdminPassword Password -AdminUsername [email protected]
$MailSettingsService = New-GDataMailSettingsService -AdminPassword Password -AdminUsername [email protected]

New-GDataUser -UserService $UserService -FamilyName $FamilyName -GivenName $GivenName -ID $id -Passsword $password
Add-GDataUserNickName -UserService $UserService -ID $id -NickName $nickname

Set-GDataMailSetting -ID $id -Name "$GivenName $FamilyName" -SenderAdress $nickname -IsDefault -MailSettingsService $MailSettingsService

creating contacts:

$ContactService = New-GDataContactService -AdminPassword Password -AdminUsername [email protected]
New-GDataContact -ContactService $ContactService -Name "Robert Jonsson" -EmailAddress [email protected] -PhoneNumber 04166547211 -PostalAddress "Ankeborg 12"

creating groups:

$GroupService = New-GDataGroupService -AdminPassword Password -AdminUsername [email protected]

New-GDataGroup -GroupService $GroupService -Name GDataCmdLet -Description "Dist Group" -ID [email protected] -EmailPermission Anyone
Add-GDataGroupMember -id [email protected] -GroupService $GroupService -UserID [email protected]

Modifying calendar sharing:

$CalendarService = New-GDataCalendarService -AdminPassword Password -AdminUsername [email protected]
$Calendar = Get-GDataCalendar -CalendarService $CalendarService -CalendarID [email protected] -ID user

Get-GDataCalendarAcl -CalendarService $CalendarService -SelfUri $Calendar.SelfUri

Add-GDataCalendarAcl -CalendarService $CalendarService -ID [email protected] -SelfUri $Calendar.SelfUri -Role READ
Remove-GDataCalendarAcl -CalendarService $CalendarService -ID [email protected] -SelfUri $Calendar.SelfUri
Clone this wiki locally