none
How to use Microsoft Exchange Web Services to retrieve meeting form other contacts in the same domain? RRS feed

  • Question

  • Hello,

    I would like to retrieve calender items from Outlook 2010. Currently I could only retrieve items from my own calender folder by this:-

    private static void CalenderItem()
    {
        ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010);
        service.Credentials = new WebCredentials();
    
        service.AutodiscoverUrl("fname.lname@work.com", RedirectionUrlValidationCallback);
    
        // Initialize values for the start and end times, and the number of appointments to retrieve.
        DateTime startDate = DateTime.Now;
        DateTime endDate = startDate.AddDays(30);
        const int NUM_APPTS = 10;
                
        // Initialize the calendar folder object with only the folder ID. 
        CalendarFolder calendar = CalendarFolder.Bind(service, WellKnownFolderName.Calendar, new PropertySet());
    
        // Set the start and end time and number of appointments to retrieve.
        CalendarView cView = new CalendarView(startDate, endDate, NUM_APPTS);
    
        // Limit the properties returned to the appointment's subject, start time, and end time.
        cView.PropertySet = new PropertySet(AppointmentSchema.Subject, AppointmentSchema.Start, AppointmentSchema.End);
    
        // Retrieve a collection of appointments by using the calendar view.
        FindItemsResults<Appointment> appointments = calendar.FindAppointments(cView);
    
        foreach (Appointment a in appointments)
        {
            Console.Write("Subject: " + a.Subject.ToString() + " ");
            Console.Write("Start: " + a.Start.ToString() + " ");
            Console.Write("End: " + a.End.ToString());
            Console.WriteLine();
        }
    }

    But I have to retrieve shared/public calendar that placed in a public folder. I have tried many option so far but nothing is working. Could you please show me how to use these api to get all calender meeting from the same exchange server? Thanks in advance!


    Do it now! - Today will be yesterday tomorrow MadSum



    • Edited by masiboo Wednesday, May 14, 2014 6:40 AM
    • Moved by Fred Bao Thursday, May 15, 2014 2:43 AM Exchange Server Related
    Wednesday, May 14, 2014 6:20 AM

All replies

  • Hello,

    For issues regarding Exchange Server Development, I would like suggest you post it to:
    http://social.technet.microsoft.com/Forums/exchange/en-US/home?forum=exchangesvrdevelopment

    And I will help move this thread to there for getting better help.

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, May 15, 2014 2:42 AM
  • Change the line

    CalendarFolder calendar = CalendarFolder.Bind(service, WellKnownFolderName.Calendar, new PropertySet());
    

    to

                String MailboxToAccess = "user@domain.com";
                FolderId calendarFolderId = new FolderId(WellKnownFolderName.Calendar, MailboxToAccess);
                CalendarFolder calendar = CalendarFolder.Bind(service, calendarFolderId, new PropertySet());

    This will then use Delegate Access to access the other users calendar folder see http://msdn.microsoft.com/en-us/library/office/gg274408(v=exchg.80).aspx

    Cheers
    Glen

    Thursday, May 15, 2014 4:01 AM