簡體   English   中英

使用 Google 日歷設置活動作者 API

[英]Set event author with Google Calendar API

使用以下代碼將事件添加到 Google 日歷時,我正在嘗試設置作者:

        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 eventTime = 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);

除了作者之外,該事件被添加了所有正確的屬性。 作者仍然是日歷的所有者。 有任何想法嗎?

根據日歷 API 文檔(http://code.google.com/apis/calendar/data/2.0/developers_guide_protocol.html#CreatingSingle):

服務器將根據提交請求的用戶(即伴隨請求的身份驗證令牌的用戶)插入作者信息。

創建事件時無法設置作者字段的值。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM