先有一個google帳號

(這應該是理所當然的吧!)

之後到申請API的開通

https://code.google.com/

 

選擇「Services」

開啟「Contacts API」,要注意的是每個API有它自使用的限制

基本上是夠用的

它的是包在.dll裡

所以到下面下載Google_Data_API_Setup_*.msi

*,代表版本別

http://code.google.com/p/google-gdata/downloads/list

 

下載完後

無腦安裝

會在系統裡產生.dll

C:\Program Files (x86)\Google\Google Data API SDK\Redist

 

開一個專案

引用

using Google.Contacts;

using Google.GData.Client;

using Google.GData.Contacts;

using Google.GData.Extensions;

就可以進行開發了

 

       var cr = new ContactsRequest(new RequestSettings("", "xxxx@gmail.com", "password") { AutoPaging = true });

       foreach (Contact i in cr.GetContacts().Entries)

       {        

           this.DropDownList1.Items.Add(i.Title + "-" +(i.Phonenumbers.Count>0? i.Phonenumbers[0].Value:""));

       }

更詳細的用法請見:

https://developers.google.com/google-apps/spreadsheets/?hl=zh-TW&csw=1

 

 附注:

有個問題

如果你上傳的伺服器是在別個國家

google會很好心的提醒你

有時候甚至把那端client封了


arrow
arrow
    文章標籤
    C# google 連絡人 API
    全站熱搜

    倧齊 發表在 痞客邦 留言(0) 人氣()