Reputation: 518
i am developing my app on google calendar integration. I got the error "Object Not initialized" when i am adding attendee to the EventAttendee object. Please review the code below...
Event Entry = new Event();
Entry.Summary = MeetingName;
Entry.Description = MeetingDetails;
EventDateTime dt_Start = new EventDateTime();
dt_Start.DateTime = meeting.StartTime.ToString("yyyy-MM-ddThh:mm:ss.000Z");
Entry.Start = dt_Start;
EventDateTime dt_End = new EventDateTime();
dt_End.DateTime = meeting.EndTime.ToString("yyyy-MM-ddThh:mm:ss.000Z");
Entry.End = dt_End;
if (invitees != null)
{
foreach (Participant invitee in invitees)
{
String str = invitee.Email;
str = invitee.Name;
Entry.Attendees.Add(new EventAttendee()
{
Email = invitee.Email,
DisplayName = WEB.HttpUtility.HtmlDecode(invitee.Name),
ResponseStatus = "accepted",
Organizer=false,
Resource=false
});
}
}
place where i am doing "Entry.Attendees.Add(new EventAttendee()" at this point i am getting the error...
Upvotes: 1
Views: 1700
Reputation: 196
I think you need to instantiate the list of EventAttendees first.
Try adding this after you create the entry-
Entry.Attendees = new List<EventAttendee>();
Then you could try this to add them-
var att = new EventAttendee()
{
DisplayName = "Bill Smith",
Email = "[email protected]",
Organizer = false,
Resource = false,
};
Entry.Attendees.Add(att);
Upvotes: 1
Reputation: 13528
You should not be setting anything other than the email address for the attendee. The response status is for the attendee to set (why would you be able to accept a meeting for me that you created?) and the Organizer and Resource attributes are set by Google. It may be possible to set a DisplayName but it is not mandatory.
Upvotes: 0