none
EWS security question RRS feed

  • Question

  • Hi,

    We have a link to EWS via 365 which sort of works, but we don't know why its not working 100% and need some advice.

    We are trying to access peoples diary information on 365 using EWS but it only works for 7 users not everyone!!!

    I have looked through the groups and permissions and cannot see any differences between these 7 users and the other 50.

    Has anyone seen this before and can offer some advice ?

    here is the abridged code:

                ExchangeService myExchangeService = new ExchangeService(ExchangeVersion.Exchange2010);
                myExchangeService.Credentials = new WebCredentials(myExchangeUserId, myExchangeUserPassword, myExchangeOnLineDomain);
                myExchangeService.AutodiscoverUrl(myExchangeUserId, RedirectionCallback);
                        BindingList<Customer> myCustomerList = Customer.GetList(myOffice.id, false, myConnectionString);
                        foreach (Customer myCustomer in myCustomerList)
    {
                     FolderId myFolderId = new FolderId(WellKnownFolderName.Calendar, myCustomer.smtpEmail);
                     CalendarFolder myCalendarFolder = CalendarFolder.Bind(myExchangeService, myFolderId, new PropertySet());
                     CalendarView myCalendarView = new CalendarView(myStartTime, myEndTime);
                     myCalendarView.PropertySet = new PropertySet(AppointmentSchema.Id, AppointmentSchema.Subject, AppointmentSchema.Start, AppointmentSchema.IsAllDayEvent, AppointmentSchema.Duration);
    
                                    FindItemsResults<Microsoft.Exchange.WebServices.Data.Appointment> myAppointmentList = myCalendarFolder.FindAppointments(myCalendarView);
    
                                    foreach (Microsoft.Exchange.WebServices.Data.Appointment myAppointment in myAppointmentList)
                                    {
                                        Diary myDiary = new Diary();
                                        myDiary.customerId = myCustomer.id;
                                        myDiary.OfficeId = myOffice.id;
                                        myDiary.exchangeId = myAppointment.Id.UniqueId;
                                        myDiary.igSubject = "Not available";
                                        if (myAppointment.IsAllDayEvent)
                                        {
                                            myDiary.igAllDayEvent = true;
                                            myDiary.igStartDateTimeUtc = myAppointment.Start.Date.AddHours(9);
                                            myDiary.igDuration = 28800;
                                        }
                                        else
                                        {
                                            myDiary.igStartDateTimeUtc = myAppointment.Start;
                                            myDiary.igDuration = Convert.ToInt32(myAppointment.Duration.TotalSeconds);
                                        }
                                        Diary.Insert(myDiary, myConnectionString);
    }
    }
    

    Many thanks in advance.

    Peter


    Newbie web developer

    Monday, January 27, 2014 5:19 PM

All replies