Error msg - you must load or assign this property before you can read its value.

Hi Team,

I am getting this error   "you must load or assign this property before you can read its value", when I am trying to assign the name  like below.

                      meeting.Organizer.Name = "Test";

Service Account ID is created as EXCHANGEEMAIL. As of now i am receving the MeetingInvite with From as "EXCHANGEEMAIL". I want to show From with different name instead of EXCHANGEEMAIL  say I want to show the name as Test

Below is my code and please help me with inputs..

                                                                     

 private void SendMeetingInvite(string to, string subject, string meetinglocation )
        {
            ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010);                  
            NetworkCredential myCred = new NetworkCredential(ConfigurationManager.AppSettings["ServiceAccount"], ConfigurationManager.AppSettings["ServicePassword"], ConfigurationManager.AppSettings["Domain"]);

            service.Credentials = myCred;
            service.TraceEnabled = true;
            service.TraceFlags = TraceFlags.All;
            service.AutodiscoverUrl(ConfigurationManager.AppSettings["ExchangeAddress"], RedirectionUrlValidationCallback);
            Appointment meeting = new Appointment(service);

            // Set the properties on the meeting object to create the meeting.
            meeting.Subject = subject;
            meeting.Body = "This is the email I've sent by using the EWS Managed API!";
            meeting.Start = DateTime.Now.AddMinutes(15);
            meeting.End = meeting.Start.AddHours(1);
            meeting.Location = meetinglocation;
meeting.Organizer.Name = "test";



            // attendees for meeting/required participants          
            if (!string.IsNullOrEmpty(to))
            {
                if (to.Contains(";"))
                {
                    string[] MailTo = Regex.Split(to, ";");
                    foreach (string To in MailTo)
                    {
                        if (!string.IsNullOrEmpty(To))
                        {
                           meeting.RequiredAttendees.Add(To);
                        }
                    }
                }
                else
                {
                    meeting.RequiredAttendees.Add(to);
                }
            }
            meeting.ReminderMinutesBeforeStart = 5;

            // Save the meeting to the Calendar folder and send the meeting request.
            meeting.Save(SendInvitationsMode.SendToAllAndSaveCopy);
            meetingId = meeting.Id.ToString();

            // Verify that the meeting was created.
            Item item = Item.Bind(service, meeting.Id, new PropertySet(ItemSchema.Subject));

            label1.Text = "Meeting Invitation is sent successfully";

}

Thanks

July 20th, 2015 1:01pm

Hi Team,

I am getting this error   "you must load or assign this property before you can read its value", when I am trying to assign the name  like below.

                      meeting.Organizer.Name = "Test";

Service Account ID is created as EXCHANGEEMAIL. As of now i am receving the MeetingInvite with From as "EXCHANGEEMAIL". I want to show From with different name instead of EXCHANGEEMAIL  say I want to show the name as Test

Below is my code and please help me with inputs..

                                                                     

 private void SendMeetingInvite(string to, string subject, string meetinglocation )
        {
            ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010);                  
            NetworkCredential myCred = new NetworkCredential(ConfigurationManager.AppSettings["ServiceAccount"], ConfigurationManager.AppSettings["ServicePassword"], ConfigurationManager.AppSettings["Domain"]);

            service.Credentials = myCred;
            service.TraceEnabled = true;
            service.TraceFlags = TraceFlags.All;
            service.AutodiscoverUrl(ConfigurationManager.AppSettings["ExchangeAddress"], RedirectionUrlValidationCallback);
            Appointment meeting = new Appointment(service);

            // Set the properties on the meeting object to create the meeting.
            meeting.Subject = subject;
            meeting.Body = "This is the email I've sent by using the EWS Managed API!";
            meeting.Start = DateTime.Now.AddMinutes(15);
            meeting.End = meeting.Start.AddHours(1);
            meeting.Location = meetinglocation;
meeting.Organizer.Name = "test";



            // attendees for meeting/required participants          
            if (!string.IsNullOrEmpty(to))
            {
                if (to.Contains(";"))
                {
                    string[] MailTo = Regex.Split(to, ";");
                    foreach (string To in MailTo)
                    {
                        if (!string.IsNullOrEmpty(To))
                        {
                           meeting.RequiredAttendees.Add(To);
                        }
                    }
                }
                else
                {
                    meeting.RequiredAttendees.Add(to);
                }
            }
            meeting.ReminderMinutesBeforeStart = 5;

            // Save the meeting to the Calendar folder and send the meeting request.
            meeting.Save(SendInvitationsMode.SendToAllAndSaveCopy);
            meetingId = meeting.Id.ToString();

            // Verify that the meeting was created.
            Item item = Item.Bind(service, meeting.Id, new PropertySet(ItemSchema.Subject));

            label1.Text = "Meeting Invitation is sent successfully";

}

Thanks

Free Windows Admin Tool Kit Click here and download it now
July 20th, 2015 1:06pm

Hi

Duplicate, same as this post:

https://social.technet.microsoft.com/Forums/en-US/8dbd2f8e-72bb-4c51-b8ca-c1046b2a44fd/error-msg-you-must-load-or-assign-this-property-before-you-can-read-its-value?forum=exchangesvrdevelopment

July 20th, 2015 2:16pm

Mistakenly, I have posted twice...

Vamshi

Free Windows Admin Tool Kit Click here and download it now
July 20th, 2015 2:21pm

>>Service Account ID is created as EXCHANGEEMAIL. As of now i am receving the MeetingInvite with From as "EXCHANGEEMAIL". I want to show From with different name instead of EXCHANGEEMAIL  say I want to show the name as Test

In that case you need to SendAs the user you want the invitations to come from you can do this either by using Impersonation https://msdn.microsoft.com/en-us/library/office/dd633680(v=exchg.80).aspx  or if you have Full/SendAS rights to the Organizers Mailbox you want to send from then you need to set the save location to the calendar or the Organizer you want to use. eg

            Appointment apt = new Appointment(service);
            apt.Subject = "Test SendAs";
            apt.RequiredAttendees.Add("1@dom.com");
            apt.RequiredAttendees.Add("user2@dom.com");
            apt.Start = DateTime.Now;
            apt.End = DateTime.Now.AddHours(1);
            FolderId SendAsOrgCalendar = new FolderId(WellKnownFolderName.Calendar, "sendas@domain.com");
            apt.Save(SendAsOrgCalendar, SendInvitationsMode.SendToAllAndSaveCopy);

 In EWS the Organizer property is Read-only and will be set to the Creator of the appointment at the time or creation  so meeting.Organizer.Name = "Test"; is not a valid operation.

Cheers
Glen

July 21st, 2015 12:21am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics