2013-04-02 5 views
2

여기Google Apps 도메인의 사용자에 대한 연락처를 얻으려면 어떻게해야하나요?

$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) 

그래서, 지금은 연락처를 검색하려고 (그것은 일반적으로 편리하기 때문에 내가 PowerShell을 사용하고 있습니다) 설정 코드입니다 :

$contReq.GetContacts() 

이 작품을 ... 그리고 나에게 내 연락처를 제공합니다 (도메인 수퍼 관리자로). 이것은 나에게 내가뿐만 아니라 요청을 로그에 부착 된 GDataLoggingRequestFactory 계수를 얻을했고, 단지 어떤 세부, 401 오류를 표시

format-default : Execution of request failed: https://www.google.com/m8/feeds/contacts/[email protected]/full 

같은 오류를 제공

$contReq.GetContacts("[email protected]") 

쿨.

+0

@ site.com없이 "임의 사용자"를 사용해 보셨나요? –

+0

예, 있습니다. 슬프게도, 같은 결과 –

+0

BTW, 에뮬레이트하려는 코드는 https://code.google.com/p/google-api-dotnet-client/wiki/OAuth2#Service_Accounts입니다. –

답변

0

질문 된 것으로 시작하지만 이후 나는

내가 여기에 최신 .NET client library distribution

을 사용하고 있습니다 ...이 같은 프로젝트에서 작업 작동 PS 코드의 샘플입니다 해요 :

이 도움이
$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", "[email protected]", "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 "[email protected]" } 
$user.Title 

희망 ...

내가 Outlook 연락처에서 내 Gmail 연락처를 업데이트 당신이 필요하면 알려 할 수 있도록 할 코드 일하고 있어요

꼬리 ... :)