开发者

Set event author with Google Calendar API

I'm trying to set the author when adding an event to a Google Calendar with this code:

        CalendarService service = new CalendarService("TestApp");
        service.setUserCredentials("example@gmail.com", "1234");

        EventEntry entry = new EventEntry();

        // Set the title and content of the entry.
        entry.Title.Text = "Test";
        entry.Content.Content = "Test";

        // Not working
        AtomPerson author = new AtomPerson(AtomPersonType.Author);
        author.Name = "John Doe";
        author.Email = "john@example.com";
        entry.Authors.Add(author);

        When eve开发者_Python百科ntTime = new When(activity.Start, activity.End, activity.Start == activity.End ? true : false);
        entry.Times.Add(eventTime);

        Uri postUri = new Uri("https://www.google.com/calendar/feeds/default/private/full");

        // Send the request and receive the response:
        AtomEntry insertedEntry = service.Insert(postUri, entry);

The event gets added with all the correct attributes except the author. The author remains the owner of the calendar. Any ideas?


As per the Calendar API documentation (http://code.google.com/apis/calendar/data/2.0/developers_guide_protocol.html#CreatingSingle):

The server will insert author information based on the user that submits the request (i.e. the user whose authentication token accompanies the request).

It is not possible to set the value of the Author field when creating an event.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜