Ews get data from exchange shared calender

//ExchangeService service = new ExchangeService();   

            ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP2);            

            service.Credentials = new NetworkCredential("test1", "abcdefg", "abc");

            service.Url = new Uri("https://mail.abc.local/ews/Exchange.asmx");

            

            /*

            //service.AutodiscoverUrl("[email protected]", ValidateRedirectionUrlCallback);

            SearchFilter sf = new SearchFilter.Exists(EmailMessageSchema.Subject);

            

            //查找Inbox,加入过滤器条件,结果10条 

            FindItemsResults<Item> findResults = null;

            try

            {

                findResults = service.FindItems(WellKnownFolderName.Inbox, sf, new ItemView(10));

                

            }

            catch (Exception ex)

            {

                Console.WriteLine(ex.Message);

            }



            foreach (Item item in findResults.Items)

            {



                EmailMessage email = EmailMessage.Bind(service, item.Id);

                Console.WriteLine(email.Subject);

            }

            */



            //get caldndar

            //var _cal = new Microsoft.Exchange.WebServices.Data.FolderId(Microsoft.Exchange.WebServices.Data.WellKnownFolderName.Calendar, new Microsoft.Exchange.WebServices.Data.Mailbox(_otherAddress));

            var _cal = new Microsoft.Exchange.WebServices.Data.FolderId(Microsoft.Exchange.WebServices.Data.WellKnownFolderName.Calendar);

            var _calendarView = new Microsoft.Exchange.WebServices.Data.CalendarView(System.DateTime.Now.AddMonths(-2),System.DateTime.Now.Date.AddDays(1));

            foreach(Microsoft.Exchange.WebServices.Data.Appointment appointmentItem  in     service.FindAppointments(_cal, _calendarView))

            {

                Console.WriteLine(appointmentItem.Subject);

            }

 

 

public static void MyTest2()

        {

            ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP2);

            service.Credentials = new NetworkCredential("test3", "aaa", "dsspp");

            //service.Url = new Uri("https://hn013.dsspp.local/ews/Exchange.asmx");

            service.Url = new Uri("https://hano.dsspp.local/ews/Exchange.asmx");



            //service.Credentials = new NetworkCredential("administrator", "Abcd1234", "temp");

            //service.Url = new Uri("https://cass.temp.local/ews/Exchange.asmx");



            var rootfolder = Folder.Bind(service, WellKnownFolderName.PublicFoldersRoot);

            rootfolder.Load();

            foreach (Folder folder in rootfolder.FindFolders(new FolderView(int.MaxValue)))

            {

                if (!string.IsNullOrEmpty(folder.DisplayName))

                {

                    Console.WriteLine(folder.DisplayName);

                    try

                    {

                        foreach (Folder f1 in folder.FindFolders(new FolderView(int.MaxValue)))

                        {

                            if (f1.DisplayName.ToLower() == "kalender")

                            {

                                Console.WriteLine("   ---------");

                                var _cal = f1.Id;

                                var _calendarView = new Microsoft.Exchange.WebServices.Data.CalendarView(System.DateTime.Now.AddMonths(-2), System.DateTime.Now.Date.AddDays(1));

                                foreach (Microsoft.Exchange.WebServices.Data.Appointment appointmentItem in service.FindAppointments(_cal, _calendarView))

                                {

                                    Console.WriteLine(appointmentItem.Subject);

                                }

                                Console.WriteLine("   ---------");



                            }

                            Console.WriteLine(" ++" + f1.DisplayName);

                            foreach (Folder f2 in f1.FindFolders(new FolderView(int.MaxValue)))

                            {                                

                                Console.WriteLine("    ++" + f2.DisplayName);

                            }

                        }

                    }

                    catch (Exception ex)

                    {

                        Console.WriteLine(" --" + ex.Message);

                    }

                }

            }

        }

 

http://stackoverflow.com/questions/3631531/extract-exchange-2007-public-calendar-appointments-using-exchange-web-services-a

 

http://msdn.microsoft.com/en-us/library/exchange/jj220501(v=exchg.80).aspx

 

 http://www.dotnetfunda.com/codes/code1268-display-calendar-view-using-sharepoint-in-csharp-script.aspx

 

http://www.c-sharpcorner.com/Blogs/9396/programmatically-add-an-event-to-sharepoint-2010-calendar.aspx

 

Ews

 http://msdn.microsoft.com/en-us/library/exchange/dd633710(v=exchg.80).aspx

http://www.microsoft.com/en-us/download/details.aspx?id=35371

http://msdn.microsoft.com/en-us/library/exchange/dd633710(v=exchg.80).aspx

 

http://msdn.microsoft.com/en-us/library/exchange/dd633709(v=exchg.80).aspx 

 

http://code.msdn.microsoft.com/Exchange-2013-101-Code-3c38582c/view/SamplePack/3?sortBy=Popularity

 

你可能感兴趣的:(Exchange)