当前位置: 首页>>代码示例>>C#>>正文


C# Microsoft.Office.Interop.Outlook.ClearRecurrencePattern方法代码示例

本文整理汇总了C#中Microsoft.Office.Interop.Outlook.ClearRecurrencePattern方法的典型用法代码示例。如果您正苦于以下问题:C# Microsoft.Office.Interop.Outlook.ClearRecurrencePattern方法的具体用法?C# Microsoft.Office.Interop.Outlook.ClearRecurrencePattern怎么用?C# Microsoft.Office.Interop.Outlook.ClearRecurrencePattern使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.Office.Interop.Outlook的用法示例。


在下文中一共展示了Microsoft.Office.Interop.Outlook.ClearRecurrencePattern方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UpdateRecurrence

        /// <summary>
        /// Update Recurrence pattern from Google by parsing the string, see also specification http://tools.ietf.org/html/rfc2445
        /// </summary>
        /// <param name="master"></param>
        /// <param name="slave"></param>
        public static void UpdateRecurrence(Event master, Outlook.AppointmentItem slave)
        {
            var masterRecurrence = master.Recurrence;
            if (masterRecurrence == null)
            {
                if (slave.IsRecurring && slave.RecurrenceState == Outlook.OlRecurrenceState.olApptMaster)
                    slave.ClearRecurrencePattern();

                return;
            }

            try
            {

                 Outlook.RecurrencePattern slaveRecurrence = slave.GetRecurrencePattern();

                 if (master.Start != null && !string.IsNullOrEmpty(master.Start.Date))
                 {
                     slaveRecurrence.StartTime = DateTime.Parse(master.Start.Date);
                     slaveRecurrence.PatternStartDate = DateTime.Parse(master.Start.Date);
                 }
                 else if (master.Start != null && master.Start.DateTime != null)
                 {
                     slaveRecurrence.StartTime = master.Start.DateTime.Value;
                     slaveRecurrence.PatternStartDate = master.Start.DateTime.Value;
                 }

                //string[] patterns = masterRecurrence.Value.Split(new char[] {'\r','\n'}, StringSplitOptions.RemoveEmptyEntries);
                //foreach (string pattern in patterns)
                //{
                //    if (pattern.StartsWith(DTSTART))
                //    {
                //        //DTSTART;VALUE=DATE:20070501
                //        //DTSTART;TZID=US-Eastern:19970905T090000
                //        string[] parts = pattern.Split(new char[] {';',':'});

                //        slaveRecurrence.StartTime = GetDateTime(parts[parts.Length-1]);
                //        slaveRecurrence.PatternStartDate = GetDateTime(parts[parts.Length - 1]);
                //        break;
                //    }
                //}

                if (master.End != null && !string.IsNullOrEmpty(master.End.Date))
                     slaveRecurrence.EndTime = DateTime.Parse(master.End.Date);
                 if (master.End != null && master.End.DateTime != null)
                     slaveRecurrence.EndTime = master.End.DateTime.Value;

                //foreach (string pattern in patterns)
                //{
                //    if (pattern.StartsWith(DTEND))
                //    {
                //        string[] parts = pattern.Split(new char[] { ';', ':' });

                //        slaveRecurrence.EndTime = GetDateTime(parts[parts.Length-1]);
                //        //Don't update, otherwise it will end after first occurrence: slaveRecurrence.PatternEndDate = GetDateTime(parts[parts.Length - 1]);

                //        break;
                //    }
                //}

                foreach (string pattern in master.Recurrence)
                {
                    if (pattern.StartsWith(RRULE))
                    {
                        string[] parts = pattern.Split(new char[] { ';', ':' });

                        int instance = 0;
                        foreach (string part in parts)
                        {
                            if (part.StartsWith(BYDAY))
                            {
                                string[] days = part.Split(',');
                                foreach (string day in days)
                                {
                                    string dayValue = day.Substring(day.IndexOf("=") + 1);
                                    if (dayValue.StartsWith("1"))
                                        instance = 1;
                                    else if (dayValue.StartsWith("2"))
                                        instance = 2;
                                    else if (dayValue.StartsWith("3"))
                                        instance = 3;
                                    else if (dayValue.StartsWith("4"))
                                        instance = 4;

                                    break;
                                }

                                break;
                            }

                        }

                        foreach (string part in parts)
                        {

//.........这里部分代码省略.........
开发者ID:kcarnold,项目名称:googlesyncmod,代码行数:101,代码来源:AppointmentSync.cs


注:本文中的Microsoft.Office.Interop.Outlook.ClearRecurrencePattern方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。