Skip to content

Powershell code sample

robertj edited this page Sep 14, 2010 · 8 revisions

creating user accounts:

$UserService = New-GDataUserService -AdminPassword Password -AdminUsername admin@domain.com
$MailSettingsService = New-GDataMailSettingsService -AdminPassword Password -AdminUsername admin@domain.com

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 admin@domain.com
New-GDataContact -ContactService $ContactService -Name "Robert Jonsson" -EmailAddress robert.jonsson@plan-tre.net -PhoneNumber 04166547211 -PostalAddress "Ankeborg 12"

creating groups:

$GroupService = New-GDataGroupService -AdminPassword Password -AdminUsername admin@domain.com

New-GDataGroup -GroupService $GroupService -Name GDataCmdLet -Description "Dist Group" -ID gdatacmdlet@domain.com -EmailPermission Anyone
Add-GDataGroupMember -id gdatacmdlet@domain.com -GroupService $GroupService -UserID robert.jonsson@domain.com

Modifying calendar sharing:

$CalendarService = New-GDataCalendarService -AdminPassword Password -AdminUsername admin@domain.com
$Calendar = Get-GDataCalendar -CalendarService $CalendarService -CalendarID user@domain.com -ID user

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

Add-GDataCalendarAcl -CalendarService $CalendarService -ID user1@domain1.com -SelfUri $Calendar.SelfUri -Role READ
Remove-GDataCalendarAcl -CalendarService $CalendarService -ID user1@domain.com -SelfUri $Calendar.SelfUri
Clone this wiki locally