开发者

Alternate value of "FeedUri" for contacts entry

I am trying to create a contact on Google Apps. I am using Admin credential to create contact in other users in same domain.

Problem i am facing is when i use:

Uri feedUri  = new Uri(ContactsQuery.CreateContactsUri("default"));
ContactEntry createdEntry = (ContactEntry)service.Insert(feedUri, ContactEntry[0]);

It is adding contact in Admin account but i a want to put contact in other user's account.

How can i do that?

I tried with :

Uri feedUri = new Uri(ContactsQuery.CreateContactsUri("user@domain.com"));

But is giving exception: "Execution of request failed".

I am using Google Apps API version 2 for .NET.

Creating service as :

ContactsService obj_ContactService = new ContactsService("");
obj_Co开发者_如何转开发ntactService.setUserCredentials(userEmail, password); // Admin's Email and Password 


Try with:

Uri feedUri = new Uri(http://www.google.com/m8/feeds/contacts/youruser%40gmail.com/full");
ContactEntry createdEntry = (ContactEntry)service.Insert(feedUri , ContactEntry[0]);


Try this:

RequestSettings settings = new RequestSettings("yourAppName", appDomainName, DomainConsumerSecret, userId, appDomainName);   //the userId is the pure id without "@yourdomain.com" 
ContactsRequest  contactsRequest = new ContactsRequest(settings);
Uri feedUri = new Uri(ContactsQuery.CreateContactsUri("default"));
Contact createdEntry = contactsRequest.Insert<Contact>(feedUri, contact);  

the above code should work.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜