• 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("aa@aa.net.cn", 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

  • 相关阅读:
    Sql 行转换列(列转换行), JavaScript解决思路
    c# 异步线程
    C# 读取数据库存储过程返回值 笔记
    利用UtilityLibrary.dll WeifenLuo.WinFormsUI.Docking.dll控件创建工具栏效果
    关于C#Winform线程调用窗体的使用方法以及窗体的单一显示
    通过调用API函数实现的无边框窗体的拖拽,比判断坐标更快捷
    ubuntu下安装redis
    ubuntu下安装beanstalkd
    preg_match_all 执行一个全局正则表达式匹配
    mongodb的安装和进入
  • 原文地址:https://www.cnblogs.com/zyip/p/3012718.html
Copyright © 2020-2023  润新知