Google Shared Contacts - не появляется в каталогеC#

Место общения программистов C#
Ответить
Anonymous
 Google Shared Contacts - не появляется в каталоге

Сообщение Anonymous »

Я создаю общие контакты в Google, он создает контакт, но я не вижу контактов в каталоге в контактах с Google.string s = "https://www.google.com/m8/feeds";
string targetUri = @"https://www.google.com/m8/feeds/contact ... e.com/full";
string serviceAccountEmail = "123456789012-xxxx1x1xx11x1xxxxxxx11xxxx1xxx11@developer.example.com";
string serviceClientId = "123456789012-xxxx1x1xx11x1xxxxxxx11xxxx1xxx11.apps.googleusercontent.com";
X509Certificate2 certificate = new X509Certificate2(@"C:\All\mygcertificate-1xx1xxx1xx11.p12", "notasecret", X509KeyStorageFlags.Exportable);

ServiceAccountCredential credential = new ServiceAccountCredential(new ServiceAccountCredential.Initializer(serviceAccountEmail)
{
Scopes = new[]
{
"http://www.google.com/m8/feeds/contacts/"
},
User = "my.user@example.com"
}.FromCertificate(certificate));

string AuthenticationToken1 = string.Empty;
if (credential.RequestAccessTokenAsync(CancellationToken.None).Result)
{
AuthenticationToken1 = credential.Token.AccessToken;
}

Service service = new Service(s, serviceClientId);

GAuthSubRequestFactory factory = new GAuthSubRequestFactory(s, serviceClientId);
factory.Token = AuthenticationToken1;
service.RequestFactory = factory;

Contact ct = new Contact();
ct.Name = new Google.GData.Extensions.Name() { GivenName = "Ron", FamilyName = "Swanson", FullName = "Ron Swanson" };
ct.Emails.Add(new Google.GData.Extensions.EMail("Ron.Swanson@example.net", @"http://schemas.google.com/g/2005#work") { Primary = true });
ct.Phonenumbers.Add(new Google.GData.Extensions.PhoneNumber("2345555522") { Rel = @"http://schemas.google.com/g/2005#work", Primary = true});
AtomCategory atc = new AtomCategory();
atc.Term = @"http://schemas.google.com/contact/2008#contact";
atc.Scheme = @"http://schemas.google.com/g/2005#kind";
ct.Categories.Add(atc);

var atomentrytoinsert = ct.AtomEntry;

var result = service.Insert(new Uri(targetUri), atomentrytoinsert);

//Stream getresult = service.Query(new Uri(targetUri)); //this read actually gets the records i inserted...
< /code>
Если я запускаю эту последнюю прокомментированную строку, я вижу записи, которые я создал ... но когда я захожу в контакты Google и нажимаю каталог - их там нет. Также не на автозаполнении, когда я сочиняю электронную почту ... Я где -то упускаю атрибут.>

Подробнее здесь: https://stackoverflow.com/questions/312 ... -directory
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «C#»