To display appointments from Google Calendar in the Scheduler, follow the steps below.
Get Google API key
Follow the instructions from step 1 in the Browser Quickstart tutorial.
Restrict the API key
Set application and API restrictions.
Make your calendar public
Refer to the following help topic: Create & manage a public Google calendar.
Get the calendar ID
Open Google Calendar settings, choose the calendar to be integrated, and copy its ID from the Integrate calendar section.
Set up the Scheduler
Configure the CustomStore to load data from Google Calendar as shown in this demo. If a timeZone is specified in the Scheduler, ensure it is the same as in Google Calendar.
<div class="long-title"><h3>Tasks for Employees (USA Office)</h3></div>
@(Html.DevExtreme().Scheduler()
.DataSource(new JS("events"))
.StartDateExpr("start.dateTime")
.EndDateExpr("end.dateTime")
.TextExpr("summary")
.StartDayHour(7)
.TimeZone("America/Los_Angeles")
.ShowAllDayPanel(false)
.Editing(false)
.CurrentDate(new DateTime(2017, 5, 25))
.FirstDayOfWeek(FirstDayOfWeek.Sunday)
.Views(new[] {
SchedulerViewType.Day,
SchedulerViewType.WorkWeek,
SchedulerViewType.Month
})
.CurrentView(SchedulerViewType.WorkWeek)
.Height(500)
)
<script>
var PUBLIC_KEY = "AIzaSyBnNAISIUKe6xdhq1_rjor2rxoI3UlMY7k",
CALENDAR_ID = "f7jnetm22dsjc3npc2lu3buvu4@group.calendar.google.com";
var events = {
load: function(options) {
var result = $.Deferred();
$.ajax({
data: {showDeleted: false},
dataType: "json",
url: [
"https://www.googleapis.com/calendar/v3/calendars/",
CALENDAR_ID,
"/events?key=",
PUBLIC_KEY
].join("")
}).done(function(response) {
result.resolve(response.items);
});
return result.promise();
}
}
</script>
using DevExtreme.MVC.Demos.Models.SampleData;
using DevExtreme.MVC.Demos.ViewModels;
using System.Web.Mvc;
namespace DevExtreme.MVC.Demos.Controllers {
public class SchedulerController : Controller {
public ActionResult GoogleCalendarIntegration() {
return View();
}
}
}
.note {
color: rgba(128, 128, 128, 0.75);
float: right;
margin-top: 20px;
font-size: 12px;
}
.long-title h3 {
font-family: 'Segoe UI Light', 'Helvetica Neue Light', 'Segoe UI', 'Helvetica Neue', 'Trebuchet MS', Verdana;
font-weight: 200;
font-size: 28px;
text-align: center;
margin-bottom: 20px;
}