Add, Delete, Update or Move Appointments in Google Calendars using .NET

This technical tip explains how developers can use Gmail Calendars to add, retrieve delete, move or update Appointments in their own applications using Aspose.Email. Aspose.Email provides features for working with Appointments in Google calendars. Some important tasks such as adding Appointments, Retrieving list of appointments, retrieving particular appointment, updating an appointment, moving appointment from one calendar to another and deleting appointment can be performed using Google calendar. For Code Samples and other details please visit the given link.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//your code here...Adding an appointment
//Following code sample demonstrates the feature of adding an appointment in a calendar. 
//get access token
GoogleTestUser User2 = new GoogleTestUser("user", "email address", "password", "clientId", "client secret");
string accessToken = GoogleOAuthHelper.GetAccessToken(User2);
//Get IGmailclient
using (IGmailClient client = Aspose.Email.Google.GmailClient.GetInstance(accessToken))
{
    //Create local calendar
    Calendar calendar1 = new Calendar(
        "summary - " + Guid.NewGuid().ToString(),
        null,
        null,
        "Europe/Kiev");
    //Insert calendar and get id of inserted calendar
    string id = client.CreateCalendar(calendar1);
    //Get back calendar using an id
    Calendar cal1 = client.FetchCalendar(id);
    string calendarId1 = cal1.Id;
    try
    {
        //Retrieve list of appointments from the first calendar
        Appointment[] appointments = client.ListAppointments(calendarId1);
        //It shall be zero
        if (appointments.Length > 0)
        {
            Console.WriteLine("Wrong number of appointments");
            return;
        }
        //Get current time and Calculate time after an hour from now
        DateTime startDate = DateTime.Now;
        DateTime endDate = startDate.AddHours(1);
        //Initialize a mail address collection and set attendees mail address
        MailAddressCollection attendees = new MailAddressCollection();
        attendees.Add("User1.EMail@domain.com");
        attendees.Add("User3.EMail@domain.com");
        //create an appointment with above attendees
        Appointment app1 = new Appointment(
            "Location - " + Guid.NewGuid().ToString(),
            startDate,
X

Url: http://www.aspose.com/.net/email-component.aspx

Language: C# | User: Sheraz Khan | Created: Mar 5, 2014 | Tags: Appointments in Google calendars adding an appointment in calendar Retrieve list off appointments Retrieve particular appointment Update an appointment Move appointment from one calendar to another Use Google calendar