コード例 #1
0
        public static int Main(string[] args)
        {
            try
            {
                // Create the Outlook application.
                Outlook.Application oApp = new Outlook.Application();

                // Get the NameSpace and Logon information.
                // Outlook.NameSpace oNS = (Outlook.NameSpace)oApp.GetNamespace("mapi");
                Outlook.NameSpace oNS = oApp.GetNamespace("mapi");

                //Log on by using a dialog box to choose the profile.
                oNS.Logon(Missing.Value, Missing.Value, true, true);

                //Alternate logon method that uses a specific profile.
                // TODO: If you use this logon method,
                // change the profile name to an appropriate value.
                //oNS.Logon("YourValidProfile", Missing.Value, false, true);

                // Get the Calendar folder.
                Outlook.MAPIFolder oCalendar = oNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar);

                // Get the Items (Appointments) collection from the Calendar folder.
                Outlook.Items oItems = oCalendar.Items;

                // Get the first item.
                Outlook.AppointmentItem oAppt = (Outlook.AppointmentItem)oItems.GetFirst();


                // Show some common properties.
                Console.WriteLine("Subject: " + oAppt.Subject);
                Console.WriteLine("Organizer: " + oAppt.Organizer);
                Console.WriteLine("Start: " + oAppt.Start.ToString());
                Console.WriteLine("End: " + oAppt.End.ToString());
                Console.WriteLine("Location: " + oAppt.Location);
                Console.WriteLine("Recurring: " + oAppt.IsRecurring);

                //Show the item to pause.
                oAppt.Display(true);

                // Done. Log off.
                oNS.Logoff();

                // Clean up.
                oAppt     = null;
                oItems    = null;
                oCalendar = null;
                oNS       = null;
                oApp      = null;
            }

            //Simple error handling.
            catch (Exception e)
            {
                Console.WriteLine("{0} Exception caught.", e);
            }

            //Default return value
            return(0);
        }
コード例 #2
0
 //<Snippet1>
 private void AddAppointment()
 {
     try
     {
         Outlook.AppointmentItem newAppointment =
             (Outlook.AppointmentItem)
             this.Application.CreateItem(Outlook.OlItemType.olAppointmentItem);
         newAppointment.Start    = DateTime.Now.AddHours(2);
         newAppointment.End      = DateTime.Now.AddHours(3);
         newAppointment.Location = "ConferenceRoom #2345";
         newAppointment.Body     =
             "We will discuss progress on the group project.";
         newAppointment.AllDayEvent = false;
         newAppointment.Subject     = "Group Project";
         newAppointment.Recipients.Add("Roger Harui");
         Outlook.Recipients sentTo     = newAppointment.Recipients;
         Outlook.Recipient  sentInvite = null;
         sentInvite      = sentTo.Add("Holly Holt");
         sentInvite.Type = (int)Outlook.OlMeetingRecipientType
                           .olRequired;
         sentInvite      = sentTo.Add("David Junca ");
         sentInvite.Type = (int)Outlook.OlMeetingRecipientType
                           .olOptional;
         sentTo.ResolveAll();
         newAppointment.Save();
         newAppointment.Display(true);
     }
     catch (Exception ex)
     {
         MessageBox.Show("The following error occurred: " + ex.Message);
     }
 }
コード例 #3
0
        public NewJitsiAppointment()
        {
            // Get the Application object
            Outlook.Application application = Globals.ThisAddIn.Application;

            try
            {
                // Generate meeting ID
                string jitsiRoomId = getRoomId();

                // Create meeting object
                newAppointment = (Outlook.AppointmentItem)application.CreateItem(Outlook.OlItemType.olAppointmentItem);


                // Appointment details
                newAppointment.Location = "Jitsi Meet";
                newAppointment.Body     = "Join the meeting: " + (JitsiUrl.getUrlBase() + jitsiRoomId);

                // Display ribbon group, then the appointment window
                Globals.ThisAddIn.ShowRibbonAppointment = true;
                newAppointment.Display(false);
                Globals.ThisAddIn.ShowRibbonAppointment = false;

                // Set ribbon control defaults
                findThisRibbon(); // This only works after message is displayed to user
                setRequireDisplayName();
                setStartWithAudioMuted();
                setStartWithVideoMuted();
                setRoomIdText(jitsiRoomId);
            }
            catch (Exception ex)
            {
                MessageBox.Show("The following error occurred: " + ex.Message);
            }
        }
コード例 #4
0
        public NewJitsiAppointment()
        {
            // Get the Application object
            Outlook.Application application = Globals.ThisAddIn.Application;

            try
            {
                // Generate meeting ID
                string jitsiRoomId = JitsiUrl.generateRoomId();

                // Create meeting object
                newAppointment = (Outlook.AppointmentItem)application.CreateItem(Outlook.OlItemType.olAppointmentItem);


                // Appointment details
                newAppointment.Location = "Jitsi Meet";
                newAppointment.Body     = "Join the meeting: " + (JitsiUrl.getUrlBase() + jitsiRoomId);

                // Display ribbon group, then the appointment window
                Globals.ThisAddIn.ShowRibbonAppointment = true;
                newAppointment.Display(false);
                Globals.ThisAddIn.ShowRibbonAppointment = false;

                // Set Room ID field
                setRoomIdText(jitsiRoomId);
            }
            catch (Exception ex)
            {
                MessageBox.Show("The following error occurred: " + ex.Message);
            }
        }
コード例 #5
0
ファイル: MyRibbon.cs プロジェクト: booko365dev/BookExamples
        //gavdcodeend 08

        //gavdcodebegin 09
        private void btnCreateAppointment_Click(object sender, RibbonControlEventArgs e)
        {
            Outlook.Application myApplication = Globals.ThisAddIn.Application;

            Outlook.AppointmentItem newAppointment = (Outlook.AppointmentItem)
                                                     myApplication.CreateItem(Outlook.OlItemType.olAppointmentItem);

            newAppointment.Start       = DateTime.Now.AddHours(1);
            newAppointment.End         = DateTime.Now.AddHours(2);
            newAppointment.Location    = "An Empty Room";
            newAppointment.Body        = "This is a test appointment";
            newAppointment.AllDayEvent = false;
            newAppointment.Subject     = "My test";
            newAppointment.Recipients.Add("Somebody, He Is");

            Outlook.Recipients sentAppointmentTo = newAppointment.Recipients;
            Outlook.Recipient  sentInvite        = null;
            sentInvite      = sentAppointmentTo.Add("b, bbb b");
            sentInvite.Type = (int)Outlook.OlMeetingRecipientType.olRequired;
            sentInvite      = sentAppointmentTo.Add("c, ccc c");
            sentInvite.Type = (int)Outlook.OlMeetingRecipientType.olOptional;
            sentAppointmentTo.ResolveAll();
            newAppointment.Save();
            newAppointment.Display(true);
        }
コード例 #6
0
        public NewJitsiAppointment()
        {
            // Get the Application object
            Outlook.Application application = Globals.ThisAddIn.Application;

            DateTime dateNull = new DateTime(4501, 1, 1, 0, 0, 0);

            Outlook.Explorer expl = application.ActiveExplorer();
            Outlook.View     view = expl.CurrentView as Outlook.View;

            try
            {
                // Generate meeting ID
                string jitsiRoomId = getRoomId();

                // Create meeting object
                newAppointment = (Outlook.AppointmentItem)application.CreateItem(Outlook.OlItemType.olAppointmentItem);


                // Appointment details
                newAppointment.MeetingStatus = Outlook.OlMeetingStatus.olMeeting;
                newAppointment.Location      = "Jitsi Meet";
                newAppointment.Body          = generateBody(jitsiRoomId);

                // Set appointment date if selected in calendar
                if (view.ViewType == Outlook.OlViewType.olCalendarView)
                {
                    Outlook.CalendarView calView   = view as Outlook.CalendarView;
                    DateTime             dateStart = calView.SelectedStartTime;
                    DateTime             dateEnd   = calView.SelectedEndTime;
                    if (dateStart != dateNull && dateEnd != dateNull)
                    {
                        newAppointment.Start = dateStart;
                        newAppointment.End   = dateEnd;
                    }
                }

                // Display ribbon group, then the appointment window
                Globals.ThisAddIn.ShowRibbonAppointment = true;
                newAppointment.Display(false);
                Globals.ThisAddIn.ShowRibbonAppointment = false;

                // Set ribbon control defaults
                findThisRibbon(); // This only works after message is displayed to user
                setRequireDisplayName();
                setStartWithAudioMuted();
                setStartWithVideoMuted();
                setRoomIdText(jitsiRoomId);
            }
            catch (Exception ex)
            {
                MessageBox.Show("The following error occurred: " + ex.Message);
            }
        }
コード例 #7
0
 private void AllDayEventExample()
 {
     Outlook.AppointmentItem appt = Application.CreateItem(
         Outlook.OlItemType.olAppointmentItem)
                                    as Outlook.AppointmentItem;
     appt.Subject     = "Developer's Conference";
     appt.AllDayEvent = true;
     appt.Start       = DateTime.Parse("6/11/2007 12:00 AM");
     appt.End         = DateTime.Parse("6/16/2007 12:00 AM");
     appt.Display(false);
 }
コード例 #8
0
 /// <summary>
 /// Open the appointment, having in mind it might be a recurring event
 /// </summary>
 /// <param name="sender">Sender</param>
 /// <param name="e">EventArgs</param>
 private void lstAppointments_DoubleClick(object sender, EventArgs e)
 {
     if (this.lstAppointments.SelectedIndices.Count != 0)
     {
         Outlook.AppointmentItem appt = this.lstAppointments.SelectedItems[0].Tag as Outlook.AppointmentItem;
         if (appt != null)
         {
             if (appt.IsRecurring)
             {
                 FormRecurringOpen f = new FormRecurringOpen();
                 f.Title   = "Open Recurring Item";
                 f.Message = "This is one appointment in a series. What do you want to open?";
                 if (f.ShowDialog() == DialogResult.OK)
                 {
                     if (f.OpenRecurring)
                     {
                         // Open up the master appointment in a new window
                         // If we open the current instance then there is an error: "This item is no longer valid because it has been closed"
                         // One workaround is to refresh the appointments list to get new instances...
                         Outlook.AppointmentItem masterAppt = appt.Parent; // Get the master appointment item
                         masterAppt.Display(true);                         // Will modify ALL instances
                     }
                     else
                     {
                         // Open up the appointment in a new window
                         appt.Display(true); // Modal yes/no
                     }
                 }
             }
             else
             {
                 // Open up the appointment in a new window
                 appt.Display(true); // Modal yes/no
             }
             // At the end, synchronously "refresh" appointments in case they have changed
             this.RetrieveAppointments();
         }
     }
 }
コード例 #9
0
ファイル: Ribbon.cs プロジェクト: hoge8086/MailToCalendar
        /// <summary>
        /// メールの選択文字列から予定を抽出し予定作成ダイアログを開く
        /// </summary>
        /// <param name="control"></param>
        public void OnScheduleEmail(Office.IRibbonControl control)
        {
            Outlook.MailItem mailItem = null;
            string           text     = null;

            try
            {
                mailItem = GetSelectedItem <Outlook.MailItem>();
                if (mailItem == null)
                {
                    return;
                }

                //選択中のテキストを取得
                text = GetSelectedTextOnMailItem(mailItem);
            }catch (Exception ex)
            {
                ShowError("メールまたは選択テキストの取得に失敗しました。", ex);
                return;
            }

            Appointment appointment = null;
            string      place       = null;

            try
            {
                //テキストから予定を解析
                appointment = new TextAppointmentParser().Parse(text);
                place       = new TextPlaceParser().Parse(text);
            }catch (Exception ex)
            {
                ShowError("予定の解析に失敗しました。", ex);
                return;
            }

            try
            {
                //予定を作成
                Outlook.AppointmentItem apptItem = CreateAppointmentItemOnDefaultCalendar(mailItem, appointment, place);
                //予定ダイアログをモードレスで表示する
                apptItem.Display(false);
            }
            catch (Exception ex)
            {
                ShowError("予定の作成に失敗しました。\n", ex);
            }
        }
コード例 #10
0
        private void btnSend_Click(object sender, EventArgs e)
        {
            // Create an outlook application
            Outlook.Application App = new Outlook.Application();

            // Create an Appointment item, this is the way outlook manages meetings
            Outlook.AppointmentItem Meeting = App.CreateItem(Outlook.OlItemType.olAppointmentItem) as Outlook.AppointmentItem;

            // Set meeting's subject
            Meeting.Subject = txtSubject.Text;

            // Set Body
            Meeting.Body = txtMessage.Text;

            // Set Show As Status
            Meeting.BusyStatus = Outlook.OlBusyStatus.olFree;

            // Set to not request responses
            Meeting.ResponseRequested = false;

            // Set item as Meeting
            Meeting.MeetingStatus = Outlook.OlMeetingStatus.olMeeting;

            // Set Location
            Meeting.Location = txtLocation.Text;

            // Set Starting datetime
            Meeting.Start = dtpStart.Value;

            // Set Ending datetime
            Meeting.End = dtpEnd.Value;

            // Set required recipients
            Outlook.Recipient RecipReq = Meeting.Recipients.Add(txtRecipients.Text);

            // Resolve recipients
            Meeting.Recipients.ResolveAll();

            // Don't display the meeting's information
            Meeting.Display(true);

            // Send it!!!
            Meeting.Send();
        }
コード例 #11
0
ファイル: ThisAddIn.cs プロジェクト: hogie77/outlookaddin
 private void AddAppointment(DateTime start, DateTime end, string loc, string body, bool allday, string subject)
 {
     try
     {
         Outlook.AppointmentItem newAppointment =
             (Outlook.AppointmentItem)
             this.Application.CreateItem(Outlook.OlItemType.olAppointmentItem);
         newAppointment.Start       = start;
         newAppointment.End         = end;
         newAppointment.Location    = loc;
         newAppointment.Body        = body;
         newAppointment.AllDayEvent = allday;
         newAppointment.Subject     = subject;
         newAppointment.Save();
         newAppointment.Display(true);
     }
     catch (Exception ex)
     {
         MessageBox.Show("The following error occurred: " + ex.Message);
     }
 }
コード例 #12
0
        /// <summary>
        /// When the user "drops" one or more email items into the calendar
        /// </summary>
        /// <param name="sender">Sender</param>
        /// <param name="e">DragEventArgs</param>
        private void lblCtrl_DragDrop(object sender, DragEventArgs e)
        {
            Label lblDay = sender as Label;

            if (sender != null)
            {
                Outlook.Explorer mailExpl       = Globals.ThisAddIn.Application.ActiveExplorer();
                List <string>    attendees      = new List <string>();
                string           curUserAddress = OutlookHelper.GetEmailAddress(Globals.ThisAddIn.Application.Session.CurrentUser);
                string           body           = String.Empty;
                string           subject        = String.Empty;
                foreach (object obj in mailExpl.Selection)
                {
                    Outlook.MailItem mail = obj as Outlook.MailItem;
                    if (mail != null)
                    {
                        subject = mail.Subject;
                        body    = mail.Body;
                        if (mail.SenderEmailAddress != curUserAddress && !attendees.Contains(mail.SenderEmailAddress))
                        {
                            attendees.Add(mail.SenderEmailAddress);
                        }
                        attendees.AddRange(OutlookHelper.GetRecipentsEmailAddresses(mail.Recipients, curUserAddress));
                    }
                    else // It's not an email, let's see if it's a meeting instead
                    {
                        Outlook.MeetingItem meeting = obj as Outlook.MeetingItem;
                        if (meeting != null)
                        {
                            subject = meeting.Subject;
                            body    = meeting.Body;
                            if (meeting.SenderEmailAddress != curUserAddress && !attendees.Contains(meeting.SenderEmailAddress))
                            {
                                attendees.Add(meeting.SenderEmailAddress);
                            }
                            attendees.AddRange(OutlookHelper.GetRecipentsEmailAddresses(meeting.Recipients, curUserAddress));
                        }
                        else // It wasn't a meeting either, let's try with an appointment
                        {
                            Outlook.AppointmentItem appointment = obj as Outlook.AppointmentItem;
                            if (appointment != null)
                            {
                                subject = appointment.Subject;
                                body    = appointment.Body;
                                if (appointment.Organizer != curUserAddress && !attendees.Contains(appointment.Organizer))
                                {
                                    attendees.Add(appointment.Organizer);
                                }
                                attendees.AddRange(OutlookHelper.GetRecipentsEmailAddresses(appointment.Recipients, curUserAddress));
                            }
                        }
                    }
                }
                Outlook.AppointmentItem appt = Globals.ThisAddIn.Application.CreateItem(Outlook.OlItemType.olAppointmentItem) as Outlook.AppointmentItem;
                attendees.ForEach(a => appt.Recipients.Add(a));
                appt.Body    = Environment.NewLine + Environment.NewLine + body;
                appt.Subject = subject;
                DateTime day = (DateTime)lblDay.Tag;
                DateTime now = DateTime.Now;
                appt.Start = OutlookHelper.RoundUp(new DateTime(day.Year, day.Month, day.Day, now.Hour, now.Minute, now.Second), TimeSpan.FromMinutes(15));
                appt.Display();
            }
        }
コード例 #13
0
        public void NewRecurringMeetingAndUpdateOneStartTime()
        {
            // Get account name
            var desktop   = AutomationElement.RootElement;
            var nameSpace = outlookApp.GetNamespace("MAPI");

            Outlook.MAPIFolder folder   = nameSpace.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox);
            string             userName = folder.Parent.Name;

            // Get outlook window
            var condition_Outlook = new PropertyCondition(AutomationElement.NameProperty, "Inbox - " + userName + " - Outlook");
            var window_outlook    = Utilities.WaitForElement(desktop, condition_Outlook, TreeScope.Children, 10);

            // Get New Items and click it to new create meeting
            Condition             condition_NewItems = new AndCondition(new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.MenuItem), new PropertyCondition(AutomationElement.NameProperty, "New Items"));
            var                   item_NewItems      = Utilities.WaitForElement(window_outlook, condition_NewItems, TreeScope.Descendants, 10);
            ExpandCollapsePattern pattern_NewItems   = (ExpandCollapsePattern)item_NewItems.GetCurrentPattern(ExpandCollapsePatternIdentifiers.Pattern);

            pattern_NewItems.Expand();
            AutomationElement listItem = item_NewItems.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.NameProperty, "Meeting"));
            InvokePattern     clickPattern_listItem = (InvokePattern)listItem.GetCurrentPattern(InvokePattern.Pattern);

            clickPattern_listItem.Invoke();

            // Get Untitled - Meeting Window
            var condition_MeetingWindow = new PropertyCondition(AutomationElement.NameProperty, "Untitled - Meeting  ");
            var window_Meeting          = Utilities.WaitForElement(desktop, condition_MeetingWindow, TreeScope.Children, 10);

            // Add recipient in "To" text
            Condition         cd_to      = new AndCondition(new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Edit), new PropertyCondition(AutomationElement.NameProperty, "To"));
            AutomationElement item_to    = Utilities.WaitForElement(window_Meeting, cd_to, TreeScope.Descendants, 10);
            ValuePattern      pattern_to = (ValuePattern)item_to.GetCurrentPattern(ValuePattern.Pattern);

            item_to.SetFocus();
            string safeRecipent = ConfigurationManager.AppSettings["safeRecipients"].ToString();

            Thread.Sleep(100);
            SendKeys.SendWait(safeRecipent);

            // Add subject in subject text
            Condition         cd_Subject      = new AndCondition(new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Document), new PropertyCondition(AutomationElement.NameProperty, "Subject"));
            AutomationElement item_Subject    = Utilities.WaitForElement(window_Meeting, cd_Subject, TreeScope.Descendants, 10);
            ValuePattern      pattern_Subject = (ValuePattern)item_Subject.GetCurrentPattern(ValuePattern.Pattern);

            item_Subject.SetFocus();
            pattern_Subject.SetValue("Meeting test");

            // Add value for location
            Condition         cd_Location      = new AndCondition(new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.ComboBox), new PropertyCondition(AutomationElement.NameProperty, "Location"));
            AutomationElement item_Location    = Utilities.WaitForElement(window_Meeting, cd_Location, TreeScope.Descendants, 10);
            ValuePattern      pattern_Location = (ValuePattern)item_Location.GetCurrentPattern(ValuePattern.Pattern);

            item_Location.SetFocus();
            pattern_Location.SetValue("1");

            // click recurrence button to make this meeting recurrence
            Condition         cd_Recurrence         = new AndCondition(new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Button), new PropertyCondition(AutomationElement.NameProperty, "Recurrence..."));
            AutomationElement item_Recurrence       = Utilities.WaitForElement(window_Meeting, cd_Recurrence, TreeScope.Descendants, 10);
            TogglePattern     pattern_TogRecurrence = (TogglePattern)item_Recurrence.GetCurrentPattern(TogglePattern.Pattern);

            pattern_TogRecurrence.Toggle();
            PropertyCondition cd_RecurrenceWindow   = new PropertyCondition(AutomationElement.NameProperty, "Appointment Recurrence");
            AutomationElement item_RecurrenceWindow = Utilities.WaitForElement(window_Meeting, cd_RecurrenceWindow, TreeScope.Descendants, 10);
            Condition         cd_EndByEdit          = new AndCondition(new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Edit), new PropertyCondition(AutomationElement.NameProperty, "End by:"));
            AutomationElement item_EndByEdit        = Utilities.WaitForElement(item_RecurrenceWindow, cd_EndByEdit, TreeScope.Descendants, 10);
            ValuePattern      pattern_EndByEdit     = (ValuePattern)item_EndByEdit.GetCurrentPattern(ValuePattern.Pattern);

            item_EndByEdit.SetFocus();
            pattern_EndByEdit.SetValue(DateTime.Today.AddDays(1).ToShortDateString());
            Condition         cd_OKButton   = new AndCondition(new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Button), new PropertyCondition(AutomationElement.NameProperty, "OK"));
            AutomationElement item_OKButton = Utilities.WaitForElement(item_RecurrenceWindow, cd_OKButton, TreeScope.Descendants, 10);
            InvokePattern     pattern_OK    = (InvokePattern)item_OKButton.GetCurrentPattern(InvokePattern.Pattern);

            pattern_OK.Invoke();

            // Get Untitled - Meeting Window
            var condition_MeetingSeriesWindow = new PropertyCondition(AutomationElement.NameProperty, "Meeting test - Meeting Series  ");
            var window_MeetingSeriesWindow    = Utilities.WaitForElement(desktop, condition_MeetingSeriesWindow, TreeScope.Children, 10);

            // Check the receiver name
            Condition         cd_CheckName      = new AndCondition(new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Button), new PropertyCondition(AutomationElement.NameProperty, "Check Names"));
            AutomationElement item_CheckName    = Utilities.WaitForElement(window_MeetingSeriesWindow, cd_CheckName, TreeScope.Descendants, 10);
            InvokePattern     pattern_CheckName = (InvokePattern)item_CheckName.GetCurrentPattern(InvokePattern.Pattern);

            pattern_CheckName.Invoke();

            // Send meeting
            Condition         cd_send      = new AndCondition(new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Button), new PropertyCondition(AutomationElement.NameProperty, "Send"));
            AutomationElement item_send    = Utilities.WaitForElement(window_MeetingSeriesWindow, cd_send, TreeScope.Descendants, 10);
            InvokePattern     pattern_send = (InvokePattern)item_send.GetCurrentPattern(InvokePattern.Pattern);

            pattern_send.Invoke();

            // Get the newest meeting and update it
            Outlook.AppointmentItem appointmentSended = Utilities.GetAppointment();

            // Create the recall function for when "meeting" window opening
            AutomationEventHandler eventHandler = new AutomationEventHandler(Utilities.OnWindowOpen);

            // Registers the listener event
            Automation.AddAutomationEventHandler(WindowPattern.WindowOpenedEvent, desktop, TreeScope.Children, eventHandler);
            appointmentSended.Display(true);

            Outlook.Folder calFolder = outlookApp.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar) as Outlook.Folder;
            Utilities.DeleteAllItemInMAPIFolder(calFolder);

            // Parse the saved trace using MAPI Inspector
            List <string> allRopLists = new List <string>();
            bool          result      = MessageParser.ParseMessage(out allRopLists);

            // Update the XML file for the covered message
            Utilities.UpdateXMLFile(allRopLists);

            // Assert failed if the parsed result has error
            Assert.IsTrue(result, "Case failed, check the details information in error.txt file.");
        }
コード例 #14
0
        void growl_NotificationCallback(Growl.Connector.Response response, Growl.Connector.CallbackData callbackData)

        {
            if (callbackData != null && callbackData.Result == Growl.CoreLibrary.CallbackResult.CLICK)

            {
                string type = callbackData.Type;

                if (type != null && type != String.Empty)

                {
                    string id = callbackData.Data;

                    object obj = this.Session.GetItemFromID(id, Type.Missing);



                    switch (type)

                    {
                    case "mailmessage":

                        if (obj != null && obj is Outlook.MailItem)

                        {
                            Outlook.MailItem message = (Outlook.MailItem)obj;

                            EnableFullActivation();

                            message.Display(false);

                            DisableFullActivation();
                        }

                        obj = null;

                        break;

                    case "multimessage":

                        object aw = this.ActiveWindow();

                        if (aw is Microsoft.Office.Interop.Outlook.Explorer)

                        {
                            Microsoft.Office.Interop.Outlook.Explorer explorer = (Microsoft.Office.Interop.Outlook.Explorer)aw;

                            EnableFullActivation();

                            explorer.Activate();

                            DisableFullActivation();
                        }

                        else if (aw is Microsoft.Office.Interop.Outlook.Inspector)

                        {
                            Microsoft.Office.Interop.Outlook.Inspector inspector = (Microsoft.Office.Interop.Outlook.Inspector)aw;

                            EnableFullActivation();

                            inspector.Activate();

                            DisableFullActivation();
                        }

                        break;

                    case "remindermail":

                        if (obj != null && obj is Outlook.MailItem)

                        {
                            Outlook.MailItem item = (Outlook.MailItem)obj;

                            EnableFullActivation();

                            item.Display(false);

                            DisableFullActivation();
                        }

                        obj = null;

                        break;

                    case "reminderappointment":

                        if (obj != null && obj is Outlook.AppointmentItem)

                        {
                            Outlook.AppointmentItem item = (Outlook.AppointmentItem)obj;

                            EnableFullActivation();

                            item.Display(false);

                            DisableFullActivation();
                        }

                        obj = null;

                        break;

                    case "remindertask":

                        if (obj != null && obj is Outlook.TaskItem)

                        {
                            Outlook.TaskItem item = (Outlook.TaskItem)obj;

                            EnableFullActivation();

                            item.Display(false);

                            DisableFullActivation();
                        }

                        obj = null;

                        break;
                    }
                }
            }
        }