2016-04-07 25 views
0

Google Apps kişilerine Google.GData.Contacts Api kullanarak C# olayını eklemeye çalışıyorum.C# Google'da Google Apps ile iletişime geçmek için Google Apps ile iletişime geçin. #

When objwhen = new When(); 
String objwhen1 = (year + "-" + month + "-" + day); 

var nowString = dt.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ"); 
IFormatProvider culture = new System.Globalization.CultureInfo("en-US", true); 
DateTime dateVal = DateTime.ParseExact(objwhen1, "yyyy-MM-dd", null, System.Globalization.DateTimeStyles.None); 

objwhen.StartTime = dt.ToUniversalTime(); 
string str = objwhen.StartTime.ToString(); 

newContact.ContactEntry.Events.Add(new Google.GData.Contacts.Event() 
         { 

          Relation = "anniversary", 
          When = objwhen, 
          Label = "Anniversary" 
         }); 

burada Till hiçbir hata veya istisna ama takmadan kontak vardır

createdContact = contactRequest.Insert(feedUri, newContact); 

Bu istisna atar: talebinin Yürütme başarısız oldu: https://www.google.com/m8/feeds/contacts/default/full

cevap

0

solutin önerin Sen may Jetonunuzun süresi dolduğunda bir hatayla karşılaşabilirsiniz. Jetonu yeniledikten sonra her şey iyi çalışmalı. Bu SO ticket ilgili

try{ 
    cr.Insert(feedUri,newContact); 
} 
catch(System.Net.ProtocolViolationException) 
{ 
    cr.Insert(feedUri,newContact); 
} 

kontrol: Eğer belirteçleri yeniden sorun bu pasajı kullanarak ekleme çağrısı elle yenilenir ve olsun. Bu yardımcı olur umarım!

+0

Bunu denedim ama çalışmıyor. – Renuka

+0

Temasa geçmek için olay eklemeye çalışırsam, yalnızca istisna ve onun ProtokolViolationException'sini atar. – Renuka

İlgili konular