Example #1
0
        /// <summary>
        /// Get event request object for scheduling a meeting 
        /// </summary>
        /// <param name="selectedRoom">Selected room</param>
        /// <param name="normalizedEmails">List of participant emails</param>
        /// <param name="subject">Name of the meeting</param>
        /// <param name="startTime">Starting time</param>
        /// <param name="endTime">End time</param>
        /// <returns><see cref="Event" /></returns>
        public static Microsoft.Office365.OutlookServices.Event GetEvent(Room selectedRoom, string[] normalizedEmails, string subject, DateTime startTime, DateTime endTime)
        {
            var attendees = normalizedEmails.Select(email => new Microsoft.Office365.OutlookServices.Attendee
                {
                    EmailAddress = new Microsoft.Office365.OutlookServices.EmailAddress()
                    {
                        Address = email
                    }
                })
                .ToList();
            attendees.Add(new Microsoft.Office365.OutlookServices.Attendee()
            {
                EmailAddress = new Microsoft.Office365.OutlookServices.EmailAddress()
                {
                    Name = selectedRoom.Name,
                    Address = selectedRoom.Address
                }
            });

            var meeting = new Microsoft.Office365.OutlookServices.Event();

            meeting.Start = new DateTimeOffset(startTime);//, TimeZoneInfo.Local.GetUtcOffset(DateTime.Now));
            meeting.End = new DateTimeOffset(endTime);//, TimeZoneInfo.Local.GetUtcOffset(DateTime.Now));
            meeting.Subject = subject;

            Microsoft.Office365.OutlookServices.Location meetingLocation = new Microsoft.Office365.OutlookServices.Location();
            meetingLocation.DisplayName = selectedRoom.Name;

            meeting.Attendees = attendees;

            return meeting;
        }
Example #2
0
        /// <summary>
        /// Get event request object for scheduling a meeting
        /// </summary>
        /// <param name="selectedRoom">Selected room</param>
        /// <param name="normalizedEmails">List of participant emails</param>
        /// <param name="subject">Name of the meeting</param>
        /// <param name="startTime">Starting time</param>
        /// <param name="endTime">End time</param>
        /// <returns><see cref="Event" /></returns>
        public static Microsoft.Office365.OutlookServices.Event GetOutlookEvent(Room selectedRoom, string[] normalizedEmails, string subject, DateTime startTime, DateTime endTime)
        {
            var attendees = normalizedEmails.Select(email => new Microsoft.Office365.OutlookServices.Attendee
            {
                EmailAddress = new Microsoft.Office365.OutlookServices.EmailAddress()
                {
                    Address = email
                }
            })
                            .ToList();

            attendees.Add(new Microsoft.Office365.OutlookServices.Attendee()
            {
                EmailAddress = new Microsoft.Office365.OutlookServices.EmailAddress()
                {
                    Name    = selectedRoom.Name,
                    Address = selectedRoom.Address
                }
            });

            var meeting = new Microsoft.Office365.OutlookServices.Event
            {
                Start = new Microsoft.Office365.OutlookServices.DateTimeTimeZone()
                {
                    DateTime = startTime.ToString(CultureInfo.InvariantCulture),
                    TimeZone = "UTC"
                },
                End = new Microsoft.Office365.OutlookServices.DateTimeTimeZone
                {
                    DateTime = endTime.ToString(CultureInfo.InvariantCulture),
                    TimeZone = "UTC"
                },
                Subject   = subject,
                Attendees = attendees
            };

            return(meeting);
        }