Jeeva
Jeeva

Reputation: 4663

Adding and Retrieving Extended Property using Google Calendar API

I am writing a code to sync my outlook calendar with google calendar. I am able to add entry but the problem is when i want to update an item in google calendar I don't know which one to update.

For solving that I am adding extended property

        ExtendedProperty property = new ExtendedProperty();
        property.Name = reminderAppt.GlobalAppointmentID;
        property.Value = "App Id";
        entry.ExtensionElements.Add(property);

The problem is I don't know how to retrieve the same entry when ItemChanged is called.

Upvotes: 2

Views: 2791

Answers (3)

Luke G
Luke G

Reputation: 56

Using the latest SDK (Google.Apis.Calendar.v3). The following will work to set an extended property on a calendar event when it's null.

ExtendedPropertiesData property = new ExtendedPropertiesData();
        
property.Private__ = new Dictionary<string, string>();
property.Private__.Add("Name", "Luke");
        
Event.ExtendedProperties = property;

Reference: https://github.com/googleapis/google-api-dotnet-client/blob/main/Src/Generated/Google.Apis.Calendar.v3/Google.Apis.Calendar.v3.cs

Upvotes: 0

Jan
Jan

Reputation: 139

Old question, but maybe helpful for some:

The EventEntry.Insert method got a returnvalue, it returns an object which contains the unique EventId of the google calendarItem.

You can use that id to keep your calendar entries in sync with outlook.

Upvotes: 0

Shashi
Shashi

Reputation: 2898

This is what i am using in retrieving the Extended property element.

foreach (Google.GData.Client.IExtensionElementFactory  property in  googleEvent.ExtensionElements)
        {
            ExtendedProperty customProperty = property as ExtendedProperty;
            if (customProperty != null)
                genericEvent.EventID = customProperty.Value;                
        }

Upvotes: 3

Related Questions