2011-04-16 70 views
4

我正在寫一個小程序來顯示Google帳戶的所有聯繫人照片。我寫到:如何使用Google Contacts Data API通過C#獲取Google帳戶的聯繫人照片

RequestSettings rs = new RequestSettings("", inputEmail.Text, inputPassword.Text); 
ContactsRequest cr = new ContactsRequest(rs); 
Feed<Contact> fd = cr.GetContacts(); 
foreach (Contact contact in fd.Entries) 
{ 
    try 
    { 
     contact.ContactEntry. 
     photo= Image.FromStream(cr.GetPhoto(contact)); 
     Console.WriteLine("OK"); 
     // ...Other work 

    } 
    catch (Exception ex) 
    { 
        MessageBox.Show(ex.Message); 
    } 
} 

但它沒有奏效。我總是得到「Google.GData.Client.GDataNotModifiedException」錯誤。誰可以幫我修復它。非常感謝 !

+1

這是否有什麼與你的問題?我注意到他們正在使用cr.Service.Query來獲得流:http://www.google.com/support/forum/p/apps-apis/thread?tid=11644c4ca7824982&hl=en – 2011-04-16 14:57:17

+0

好!!!!!! !!!!!!!!!!!!非常感謝 :) – 2011-04-16 15:50:11

回答

5

,省去跟隨鏈接的人:

Stream s = cr.Service.Query(contact.PhotoUri); 
Image img = Image.FromStream(s); 
相關問題