以下代码在尝试检索联系人时返回错误(403 Forbidden)。
Contact contact = cr.Retrieve<Contact>(contactURI);
我将此代码基于 Google 的 Profiles API 页面。https://developers.google.com/google-apps/profiles/。我会很感激任何反馈。
RequestSettings settings = new RequestSettings("Add Profile Photo", "consumerKey", "consumerSecret", username, domain);
ContactsRequest cr = new ContactsRequest(settings);
Uri contactURI = new Uri("http://www.google.com/m8/feeds/profiles/domain/" + domain + "/full/" + username);
Contact contact = cr.Retrieve<Contact>(contactURI);
Stream outStream = File.OpenRead("C:\\temp\\profilePic.jpg");
try
{
cr.SetPhoto(contact, outStream);
}
catch (GDataVersionConflictException e)
{
throw new Exception("Exception setting photo: " + e.Message);
}