2015年5月25日 星期一

Fullcalendar 使用 google calendar event資訊 - javascript

 


參考文件:google calendar api - javascript範例

上面的參考文件使用 OAuth 2讀取非公開的日曆步驟如下:
1. Google Developers Console創件一個 project (如果有就省略)
2. API的部份記得要開通 calendar API 
3. 到憑證 (Credentials)至少要有一個 web application憑證
    a. Authorized JavaScript Origins記得要輸入網址如http://localhost:8000
        ,可以是 IP或是 domain name,可以多個,這是你實際 javascript讀取 API要識別的。
    b. Authorized Redirect URIs 要清空



4.修改範例程式
   a. Client_ID換成步驟 3憑證 Client_ID
   b. function listUpcomingEvents() 其中request.execute(function(resp),這邊要作修改
          新增一個 javascritp 陣列如 var gooEvent=[]; 然後 push (新增)至陣列中
                                      gooEvent.push({

                    id: event.id,
                    title: event.summary,
                    start: event.start.dateTime 
                    end: event.end.dateTime 
                    location: event.location,
                    description: event.description
                });
      最後再把陣列使用 fullcalendar addEventSource加到 fullcalendar中即可




2015.11.16 Write a ASP.NET MVC Web app to get Outlook mail 實作讀取 outlook.com的 mail or calendar等資訊,也跟 google很像,要先至 Application Registration Portal先註冊並設定後才可以使用,目前還沒測試,等測試完再跟大家分享。

沒有留言:

張貼留言