0
A
回答
0
這裏是我的一個項目的一段代碼:
public class GoogleContactsProvider : IContactProvider
{
#region IContactProvider Members
/// <summary>
/// Gets the contacts list form the contact provider.
/// </summary>
/// <returns></returns>
public EntityCollection<IContactItem> GetContactsList()
{
EntityCollection<IContactItem> collection = new EntityCollection<IContactItem>();
// Setup the contacts request (autopage true returns all contacts)
RequestSettings requestSettings = new RequestSettings("AgileMe", UserName, Password);
requestSettings.AutoPaging = true;
ContactsRequest contactsRequest = new ContactsRequest(requestSettings);
// Get the feed
Feed<Contact> feed = contactsRequest.GetContacts();
// create our collection by looping through the feed
foreach (Contact contact in feed.Entries)
{
GoogleContactItem newContact = new GoogleContactItem();
newContact.Name = contact.PrimaryEmail.Address;
newContact.Summary = contact.Summary;
collection.Add(newContact);
}
return collection;
}
/// <summary>
/// Gets or sets the name of the user for the contact provider.
/// </summary>
/// <value>The name of the user.</value>
public string UserName { get; set; }
/// <summary>
/// Gets or sets the password for the contact provider.
/// </summary>
/// <value>The password.</value>
public string Password { get; set; }
#endregion
}
EntityCollection是圍繞一個簡單的列表的包裝和GoogleContactItem是圍繞檢索到的信息的包裝。
0
我發現這個例子很簡單。 link 而且效果很好。
相關問題
- 1. 編程通過OAuth或的AuthSub
- 2. 獲得通過串行通信C#
- 3. 獲得通過C#中的WebBrowser控件
- 4. 如何獲得通過引用在C++
- 5. C++通過getter獲得私有價值
- 6. 通過WSDL獲得結果 - C#
- 7. 通過C#獲得網站證書
- 8. 獲得通過MooTools
- 9. 獲得通過ID
- 10. 獲得通過getElementsByName
- 11. 獲得通過的DataTemplate
- 12. 獲得通過分組
- 13. 如何在PHP中獲得安全的AuthSub會話令牌?
- 14. 獲得通過調用-WmiMethod
- 15. 獲得通過在bash
- 16. 如何在獲得新郵件時通過Microsoft Exchange Server通過C#代碼獲得通知?
- 17. 獲得通過組SQL
- 18. ListBox.ContextMenu獲得通過命令
- 19. 通過ID獲得會話
- 20. 如何獲得通過
- 21. 獲得通過文本
- 22. 獲得通過反射
- 23. 如何獲得通過setsid
- 24. 如何獲得通過HTTP
- 25. 獲得通過標籤
- 26. 如何獲得通過API
- 27. 如何獲得通過JDBC
- 28. 獲得通過反射
- 29. Javascript - 通過獲取方式獲得值通過獲取方法
- 30. 通過QJsonObject獲得鍵/值對的Foreach
@Perry,我想要一個類似的一個到stackoverflow登錄,我將重定向到Gmail輸入密碼,但在這裏我用來獲取通訊錄。謝謝 – vamsivanka 2011-04-15 14:49:46
嘿,我不確定這是你的答案,還是你試圖做別的事情?你能進一步解釋嗎? – Flawless 2011-04-15 21:37:14