none
EWS Impersonation RRS feed

  • Question

  • Hi,

    I'm working on Exchange web services to access calendar events from my asp.net c# code.The following code snippet throws an error "id property must be set".Please let me know about this issue.Any kind of suggestions will be very grateful to you.

    void ImpersonationSample()
        {
             
            ExchangeVersion exchVersion = new ExchangeVersion();
            exchVersion = ExchangeVersion.Exchange2010;
            ExchangeService service = new ExchangeService(exchVersion)
            {
                Credentials = new WebCredentials("xxxx@your-learning.com",
                                                 "xxxxxxx-password-xxxx")
            };

            service.Url = new Uri("https://pod51007.outlook.com/EWS/Exchange.asmx");
            service.ImpersonatedUserId = new ImpersonatedUserId(ConnectingIdType.SmtpAddress,
                                                               "abc@your-learning.com");
            Folder addCalendar = new Folder(service);
            addCalendar.DisplayName = "Another Calendar";
            addCalendar.FolderClass = "IPF.Appointment";
            var perm = new FolderPermission(new UserId("user@example.com"),
                                            FolderPermissionLevel.Reviewer);

            addCalendar.Permissions.Add(perm);
            addCalendar.Save(WellKnownFolderName.Calendar);

            Appointment app = new Appointment(service);
            app.Subject = "Test Appointment";
            app.Start = new DateTime(2011, 2, 14, 10, 0, 0);
            app.End = new DateTime(2011, 2, 14, 11, 0, 0);
            app.Body = "Content";
            app.Save(addCalendar.Id);

     
        }

    Thursday, April 7, 2011 5:35 AM