Quantcast
Channel: Exchange Server Development forum
Viewing all articles
Browse latest Browse all 7132

Exchange web service appointment not send to required attendees (but gets saved in my calandar)

$
0
0

I am importing an ICS attachment and saving it to my calendar. Before I do that I add some more attendees. The appointment is successfully saved in my calendar. But the required attendees are not receiving meeting/appointment request.

Here is my code

//Reading configuration file
            var userName = ConfigurationManager.AppSettings["ExchangeUserName"];
            var password = ConfigurationManager.AppSettings["ExchangePassword"];
            var exchangeUrl = ConfigurationManager.AppSettings["ExchangeURL"];
            var messageLimit = ConfigurationManager.AppSettings["MessageLimit"];


            //creating network credential for authorization
            var networkCredential = new NetworkCredential() { UserName = userName, Password = password };

            //Initializing service
            var _service = new Microsoft.Exchange.WebServices.Data.ExchangeService();
            _service.Credentials = networkCredential;
            _service.Url = new Uri(exchangeUrl);

            //setting message limit
            var _messageLimit = Convert.ToInt32(messageLimit);

            var appointment = new Microsoft.Exchange.WebServices.Data.Appointment(_service);
            using (Stream cs = message.Attachments.FirstOrDefault().ContentStream)
            {
                byte[] bytes = new byte[cs.Length];
                int numBytesToRead = (int)cs.Length;
                int numBytesRead = 0;

                while (numBytesToRead > 0)
                {
                    int n = cs.Read(bytes, numBytesRead, numBytesToRead);

                    if (n == 0)
                        break;

                    numBytesRead += n;
                    numBytesToRead -= n;
                }

                // Set the contents of the .ics file to the MimeContent property.
                appointment.MimeContent = new Microsoft.Exchange.WebServices.Data.MimeContent("UTF-8", bytes);

            }

            appointment.RequiredAttendees.Add("Aneesh@xyz.com");
            appointment.RequiredAttendees.Add("Arjun@xyz.com");
            appointment.RequiredAttendees.Add("Ajeesh@xyz.com");
            appointment.Save(Microsoft.Exchange.WebServices.Data.SendInvitationsMode.SendOnlyToAll);


Viewing all articles
Browse latest Browse all 7132

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>