0

C# アプリケーションで Google Contacts API を使用して連絡先リストを取得しようとしています。

以下は、Google連絡先を取得するために使用しているコードですが、応答の解析についてはわかりません:

        OAuthGContacts _google = new OAuthGContacts();
        if (Request["code"] == null)
        {
            Response.Redirect(_google.AuthorizationLinkGet());

        }
        else
        {
              //Get the access token and secret.
            _google.AccessTokenGet(Request["code"]);

            if (_google.Token.Length > 0)
            {
             string   _contactResponse = _google.WebRequest(OAuthGContacts.Method.GET, "https://www.google.com/m8/feeds/contacts/default/full?access_token=" + _google.Token, string.Empty);
             XmlReader reader = XmlReader.Create(new StringReader(_contactResponse ));
             SyndicationFeed feed = SyndicationFeed.Load(reader);
             reader.Close();
            }
        }

Response を解析して Google コンタクトを取得する方法を提案してください。

4

1 に答える 1

1

C# アプリケーションでは、連絡先リストを取得するために XML 応答を解析する必要はありません。Google の Data API は、そのための機能を提供します。.NET の例を次に示しますプロトコルが表示されている場合は、.NET タブをクリックするだけで、次のコードが表示されます。

public static void PrintAllContacts(ContactsRequest cr)
{
  Feed<Contact> f = cr.GetContacts();
  foreach (Contact entry in f.Entries)
  ....
于 2012-07-09T16:44:17.900 に答える