2

Here's the setup code (I'm using Powershell since it's usually convenient)

$a1= Add-Type -Path "D:\Google2.1\Google.GData.Client.dll" -passthru
$a2= Add-Type -Path "D:\Google2.1\Google.GData.Apps.dll" -passthru
$a3= Add-Type -Path "D:\Google2.1\Google.GData.Contacts.dll" -passthru
$a4= Add-Type -Path "D:\Google2.1\Google.GData.Extensions.dll" -passthru

$reqSet = New-Object Google.GData.Client.RequestSettings("testApp", $config.admin, $config.password)
$reqSet.AutoPaging = $true

$contReq = New-Object Google.Contacts.ContactsRequest($reqSet)

So, now I try to retrieve contacts:

$contReq.GetContacts()

This works... and gives me my contacts (as a domain super admin). Cool

$contReq.GetContacts("arbitraryuser@mydomain.com")

This gives me an error like

 format-default : Execution of request failed: https://www.google.com/m8/feeds/contacts/arbitraryuser@mydomain.com/full

I did get a GDataLoggingRequestFactory factor attached to log the requests as well, and just indicated a 401 error, with no details.

Kara
  • 6,115
  • 16
  • 50
  • 57

1 Answers1

0

Question starts to be old, but since i'm working on a project like this ...

I'm using the latest .NET client library distribution

Here's a sample of PS code that works :

$a1 = Add-Type -Path "C:\Program Files (x86)\Google\Google Data API SDK\Redist\Google.GData.Client.dll" -passthru

$a2 = Add-Type -Path "C:\Program Files (x86)\Google\Google Data API SDK\Redist\Google.GData.Contacts.dll" -passthru

$a3 = Add-Type -Path "C:\Program Files (x86)\Google\Google Data API SDK\Redist\Google.GData.Extensions.dll" -passthru

$Settings = New-Object Google.GData.Client.RequestSettings( "MyApp", "mybelovedtrashbox@gmail.com", "mypassword" )

$reqSet = New-Object Google.Contacts.ContactsRequest( $Settings )

$Contacts = $reqSet.GetContacts()
#loop version
foreach( $Contact in $Contacts.Entries ){
    $Contact.PrimaryEmail.Address
}

#selection version
$user = $Contacts.Entries |? { $_.PrimaryEmail.Address -eq "john.doe@gmail.com" }
$user.Title

Hope this helps ...

I'm working on code that would allow to update my gmail contacts from outlook contacts, let me know if you need intails ... :)

Laezylion
  • 143
  • 10