Esempio n. 1
0
        private void AddToNotes(Microsoft.Office.Interop.Outlook.Inspector Inspector)
        {
            Outlook.NoteItem _ObjNoteItem = (Outlook.NoteItem)Inspector.CurrentItem;

            if (Inspector.CurrentItem is Outlook.NoteItem)
            {
                _ObjNoteItem = (Outlook.NoteItem)Inspector.CurrentItem;
                bool IsExists = false;

                foreach (Office.CommandBar _ObjCmd in Inspector.CommandBars)
                {
                    if (_ObjCmd.Name == toolBarTagNote)
                    {
                        IsExists = true;
                        _ObjCmd.Delete();
                    }
                }

                Office.CommandBar _ObjCommandBar = Inspector.CommandBars.Add(toolBarTagNote, Office.MsoBarPosition.msoBarBottom, false, true);
                _objNoteToolBarButton = (Office.CommandBarButton)_ObjCommandBar.Controls.Add(Office.MsoControlType.msoControlButton, 1, missing, missing, true);

                if (!IsExists)
                {
                    _objNoteToolBarButton.Caption = "My Notes";
                    _objNoteToolBarButton.Style   = Office.MsoButtonStyle.msoButtonIconAndCaptionBelow;
                    _objNoteToolBarButton.FaceId  = 500;
                    _objNoteToolBarButton.Click  += new Office._CommandBarButtonEvents_ClickEventHandler(_objNoteToolBarButton_Click);
                    _ObjCommandBar.Visible        = true;
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// The NewInspector event fires whenever a new Inspector is displayed.
        /// </summary>
        /// <param name="Explorer"></param>
        void m_Inspectors_NewInspector(Microsoft.Office.Interop.Outlook.Inspector Inspector)
        {
            m_Ribbon.Invalidate();

            try
            {
                // Check to see if this is a new window
                // we don't already track
                OutlookInspector existingWindow = FindOutlookInspector(Inspector);
                // If the m_InspectorWindows collection does not
                // have a window for this Inspector,
                // we should add it to m_InspectorWindows
                if (existingWindow == null)
                {
                    OutlookInspector window = new OutlookInspector(Inspector);
                    window.Close             += new EventHandler(WrappedInspectorWindow_Close);
                    window.InvalidateControl += new EventHandler <OutlookInspector.InvalidateEventArgs>(WrappedInspectorWindow_InvalidateControl);
                    m_InspectorWindows.Add(window);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
        }
Esempio n. 3
0
        private void AddToEmail(Microsoft.Office.Interop.Outlook.Inspector Inspector)
        {
            Outlook.MailItem _ObjMailItem = (Outlook.MailItem)Inspector.CurrentItem;
            System.Diagnostics.Debug.WriteLine("Add to Mail");
            if (Inspector.CurrentItem is Outlook.MailItem)
            {
                System.Diagnostics.Debug.WriteLine("Add to Mail 1");
                bool IsExists = false;

                foreach (Office.CommandBar _ObjCmd in Inspector.CommandBars)
                {
                    if (_ObjCmd.Name == toolBarTagEmail)
                    {
                        IsExists = true;
                        _ObjCmd.Delete();
                    }
                }

                Office.CommandBar _ObjCommandBar = Inspector.CommandBars.Add(toolBarTagEmail, Office.MsoBarPosition.msoBarTop, false, true);
                siGamalBarButton = (Office.CommandBarButton)_ObjCommandBar.Controls.Add(Office.MsoControlType.msoControlButton, 1, missing, missing, true);

                if (!IsExists)
                {
                    System.Diagnostics.Debug.WriteLine("Add to Mail - 2");
                    siGamalBarButton.Caption = "SiGamal";
                    siGamalBarButton.Style   = Office.MsoButtonStyle.msoButtonIconAndCaptionBelow;
                    siGamalBarButton.FaceId  = 500;
                    siGamalBarButton.Click  += new Office._CommandBarButtonEvents_ClickEventHandler(siGamalBarButton_Click);
                    _ObjCommandBar.Visible   = true;
                    siGamalBarButton.Visible = true;
                }
            }
        }
Esempio n. 4
0
        public void Inspectors_NewInspector(Microsoft.Office.Interop.Outlook.Inspector Inspector)
        {
            try
            {
                Outlook.MailItem mailItem = Inspector.CurrentItem as Outlook.MailItem;

                //InitializeComObjects();

                //Calling the event before Attachment is fully added to the mail item
                mailItem.BeforeAttachmentAdd += MailItem_BeforeAttachmentAdd;

                //Calling the event when attachment is removed
                mailItem.AttachmentRemove += MailItem_AttachmentRemove;

                //Calling the event not to save the email as draft after sent
                //mailItem.Write += MailItem_Write;

                //Initializing the olRecipients which is not marked as Clear Message recipients
                olRecipients = olMailItem.Recipients;

                //Initializing the outlook email attachments object
                olAttachments = olMailItem.Attachments;
            }
            catch (Exception e)
            {
                ResetMailObjects();
                //ReleaseComObjects();
            }
        }
Esempio n. 5
0
        void Inspectors_NewInspector(Microsoft.Office.Interop.Outlook.Inspector Inspector)
        {
            Outlook.MailItem tmpMailItem = (Outlook.MailItem)Inspector.CurrentItem;

            if (Inspector.CurrentItem is Outlook.MailItem)
            {
                tmpMailItem = (Outlook.MailItem)Inspector.CurrentItem;
                bool exists = false;
                foreach (Office.CommandBar cmd in Inspector.CommandBars)
                {
                    if (cmd.Name == "EAD")
                    {
                        //exists = true;
                        cmd.Delete();
                    }
                }

                Office.CommandBar newMenuBar = Inspector.CommandBars.Add("EAD", Office.MsoBarPosition.msoBarTop, false, true);
                buttonOne = (Office.CommandBarButton)newMenuBar.Controls.Add(Office.MsoControlType.msoControlButton, 1, missing, missing, true);

                if (!exists)
                {
                    buttonOne.Caption = "Scan this mail";
                    buttonOne.Style   = Office.MsoButtonStyle.msoButtonCaption;
                    buttonOne.FaceId  = 1983;

                    //Register send event handler
                    buttonOne.Click   += new Office._CommandBarButtonEvents_ClickEventHandler(buttonOne_Click);
                    newMenuBar.Visible = true;
                }
            }
        }
Esempio n. 6
0
        //Outlook Compose Email

        //private void Inspectors_NewInspector(Microsoft.Office.Interop.Outlook.Inspector Inspector)
        //{
        //    Outlook.MailItem mailItem = Inspector.CurrentItem as Outlook.MailItem;
        //    if (mailItem != null)
        //    {
        //        if (mailItem.EntryID == null)
        //        {
        //            mailItem.Subject = "This text was added by using code";
        //            mailItem.Body = "This text was added by using code";
        //        }

        //    }
        //}

        void OutlookInspectors_NewInspector(Microsoft.Office.Interop.Outlook.Inspector Inspector)
        {
            OutlookInspector = (Outlook.Inspector)Inspector;
            if (Inspector.CurrentItem is Outlook.MailItem)
            {
                OutlookMailItem = (Outlook.MailItem)Inspector.CurrentItem;
            }
        }
        void OutlookInspectors_NewInspector(Microsoft.Office.Interop.Outlook.Inspector Inspector)
        {
            // update global inspector obj, isnpector wil be used to send signing command
            OutlookInspector = (Outlook.Inspector)Inspector;

            if (Inspector.CurrentItem is Outlook.MailItem)
            {
                // update global mailitem obj, will be used to verify sender / check if signature should be added
                OutlookMailItem = (Outlook.MailItem)Inspector.CurrentItem;
            }
        }
Esempio n. 8
0
 void Inspectors_NewInspector(Microsoft.Office.Interop.Outlook.Inspector Inspector)
 {
     if (Inspector.CurrentItem is Outlook.AppointmentItem)
     {
         appointment = Inspector.CurrentItem as Outlook.AppointmentItem;
     }
     else
     {
         appointment = null;
     }
 }
 void Inspectors_NewInspector(Microsoft.Office.Interop.Outlook.Inspector Inspector)
 {
     Outlook.MailItem mailItem = Inspector.CurrentItem as Outlook.MailItem;
     if (mailItem != null)
     {
         if (mailItem.EntryID == null)
         {
             mailItem.Subject = "This text was added by using code";
             mailItem.Body    = "This text was added by using code";
         }
     }
 }
 void Inspectors_NewInspector(Microsoft.Office.Interop.Outlook.Inspector Inspector)
 {
     if (Inspector.CurrentItem is Outlook.MailItem)
     {
         currentMailItem = null;
         Outlook.MailItem mailItem = Inspector.CurrentItem as Outlook.MailItem;
         if (mailItem != null)
         {
             currentMailItem = mailItem;
             inspectorWrappersValue.Add(Inspector, new InspectorWrapper(Inspector));
         }
     }
 }
Esempio n. 11
0
 void Inspectors_NewInspector(Microsoft.Office.Interop.Outlook.Inspector Inspector)
 {
     mailItem         = Inspector.CurrentItem as Outlook.MailItem;
     ribbonCollection = Globals.Ribbons[Globals.ThisAddIn.Application.ActiveInspector()];
     if (!string.IsNullOrEmpty(mailItem.FlagRequest) && mailItem.FlagRequest.Contains("This email is a resolution response for the case"))
     {
         ribbonCollection.Ribbon1.checkBox1.Checked = true;
         ribbonCollection.Ribbon1.checkBox1.Enabled = false;
         ribbonCollection.Ribbon1.checkBox1.Visible = true;
     }
     else
     {
         //   Globals.Ribbons.Ribbon1.checkBox1.Visible = false;
         ribbonCollection.Ribbon1.checkBox1.Checked = false;
         ribbonCollection.Ribbon1.checkBox1.Enabled = true;
         ribbonCollection.Ribbon1.checkBox1.Visible = false;
     }
 }
Esempio n. 12
0
        private void Inspectors_NewInspector(Microsoft.Office.Interop.Outlook.Inspector inspector)
        {
            Outlook.MailItem mailItem = inspector.CurrentItem as Outlook.MailItem;

            if (mailItem != null)
            {
                string senderEmail = "";

                if (mailItem.SenderEmailType == "EX")
                {
                    // Exchange email address

                    string[] directoryParts = mailItem.SenderEmailAddress.Split('=');
                    if (directoryParts.Length > 1)
                    {
                        senderEmail = directoryParts[directoryParts.Length - 1].ToLower();
                    }
                }
                else
                {
                    senderEmail = mailItem.SenderEmailAddress;

                    string fullName = mailItem.SenderName;

                    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(HOST + "?name=" + fullName.Replace(" ", "%20") + "&email=" + senderEmail);
                    request.AllowAutoRedirect = true;

                    HttpWebResponse response = (HttpWebResponse)request.GetResponse();

                    Stream       receiveStream = response.GetResponseStream();
                    StreamReader reader        = new StreamReader(receiveStream, Encoding.UTF8);

                    string results = reader.ReadToEnd();

                    MessageBox.Show(results);
                }
            }
        }
Esempio n. 13
0
        private void GetMessageID(Microsoft.Office.Interop.Outlook.Inspector Inspector)
        {
            string strMsgID = string.Empty;

            Outlook.MailItem _ObjMailItem = (Outlook.MailItem)Inspector.CurrentItem;

            if (Inspector.CurrentItem is Outlook.MailItem)
            {
                _ObjMailItem = (Outlook.MailItem)Inspector.CurrentItem;
                strMsgID     = _ObjMailItem.EntryID;

                foreach (Outlook.Attachment _attachment in _ObjMailItem.Attachments)
                {
                    _attachment.SaveAsFile(@"c:/TemP/"
                                           + strMsgID
                                           + "-"
                                           + _attachment.FileName);
                }
            }

            System.Windows.Forms.MessageBox.Show("ID:" + strMsgID, "Outlook Entry ID");
            Id = strMsgID;
        }
Esempio n. 14
0
        private void Inspectors_NewInspector(Microsoft.Office.Interop.Outlook.Inspector Inspector)
        {
            try
            {
                // this only fires when we open a new window, not when we just single click on an email
                if (Inspector.CurrentItem is Outlook.MailItem)
                {
                    Outlook.MailItem mailItem = Inspector.CurrentItem as Outlook.MailItem;
                    this.globalTaggingContext.SetMostRecentNavigatedToMailItem(mailItem);
                    HookEventHandlersToMailItem(mailItem);


                    // ((Outlook.ItemEvents_10_Event)mailItem).Send += new Outlook.ItemEvents_10_SendEventHandler(MailItem_Send);
                    System.Diagnostics.Debug.Write("NewInspector event fired for mailItem " + mailItem.Subject + " \n");

                    if (InspectorWrapper.inspectorWrappersValue.ContainsKey(Inspector))
                    {
                        System.Diagnostics.Debug.Write("SKIPPING REDUNDANT inspectorWRapper\n");
                    }
                    else
                    {
                        ((Outlook.InspectorEvents_10_Event)Inspector).Activate += new
                                                                                  Outlook.InspectorEvents_10_ActivateEventHandler(Inspector_Activated);
                        ((Outlook.InspectorEvents_10_Event)Inspector).Deactivate += new
                                                                                    Outlook.InspectorEvents_10_DeactivateEventHandler(Inspector_Deactivated);;
                        System.Diagnostics.Debug.Write("CREATING inspectorWrapper\n");
                        InspectorWrapper.inspectorWrappersValue.Add(Inspector, new InspectorWrapper(this, Inspector, mailItem));
                    }
                }
            }
            catch (Exception e)
            {
                String expMessage = e.Message;
                System.Windows.Forms.MessageBox.Show(expMessage + "\n" + e.StackTrace);
            }
        }
Esempio n. 15
0
 void Inspectors_NewInspector(Microsoft.Office.Interop.Outlook.Inspector Inspector)
 {
 }
Esempio n. 16
0
 void Inspectors_NewInspector(Microsoft.Office.Interop.Outlook.Inspector Inspector)
 {
     WriteToLog("Inspectors_NewInspector");
 }
Esempio n. 17
0
        // for create ClientId use _layouts/15/AppRegNew.aspx
        // for create permission use _layouts/15/AppInv.aspx
        // for setting _layouts/15/settings.aspx
        // Permission xml

        //<AppPermissionRequests AllowAppOnlyPolicy = "true" >
        //  < AppPermissionRequest Scope="http://sharepoint/content/sitecollection" Right="FullControl"/>
        //  <AppPermissionRequest Scope = "http://sharepoint/content/sitecollection/web" Right="FullControl"/>
        //  <AppPermissionRequest Scope = "http://sharepoint/content/sitecollection/web/list" Right="FullControl"/>
        //</AppPermissionRequests>

        //http://sharepoint/content/sitecollection
        //http://sharepoint/content/sitecollection/web
        //http://sharepoint/content/sitecollection/web/list
        //http://sharepoint/content/tenant

        //Read
        //Write
        //Manage
        //FullControl
        void Inspectors_NewInspector(Microsoft.Office.Interop.Outlook.Inspector Inspector)
        {
            Microsoft.Office.Interop.Outlook.MailItem mailItem = Inspector.CurrentItem as Microsoft.Office.Interop.Outlook.MailItem;

            ShowSubjectForm(mailItem);
        }
Esempio n. 18
0
        void Inspectors_NewInspector(Microsoft.Office.Interop.Outlook.Inspector Inspector)
        {
            Outlook.MailItem mailItem = Inspector.CurrentItem as Outlook.MailItem;

            try
            {
                if ((mailItem == null) || (mailItem.EntryID == null))
                {
                    return;
                }

                Outlook.Folder parentFolder = mailItem.Parent as Outlook.Folder;
                if (parentFolder.Name != "Caixa de Entrada")
                {
                    return;
                }

                if (mailItem.Categories == null || !mailItem.Categories.Contains("#"))
                {
                    return;
                }

                if (!this.BuscarPorEmail(getSenderEmailAddress(mailItem)))
                {
                    MessageBox.Show("Email de contato de cliente não econtrado!"
                                    + "\n\nTicket não pode ser cadastrado!", "Ticket.OutlookAddIn", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                if (MessageBox.Show("Contato: " + emailSender
                                    + "\n\nCliente: " + customerAbrev
                                    + "\n\nCriar Ticket #?", "Ticket.OutlookAddIn", MessageBoxButtons.YesNo,
                                    MessageBoxIcon.Question) == DialogResult.No)
                {
                    return;
                }

                Outlook.MAPIFolder inBox = (Outlook.MAPIFolder) this.Application.
                                           ActiveExplorer().Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox);

                Outlook.MAPIFolder destFolder = inBox.Folders["_Tickets"];

                //mailItem.Body += "\n\n# Ticket";
                mailItem.Categories = "#; Novo; " + customerAbrev;
                mailItem.Save();
                mailItem = mailItem.Move(destFolder);

                string msg = string.Empty;

                this.GravarTicket(ref mailItem, ref msg);

                if (msg != string.Empty)
                {
                    MessageBox.Show("Erro:\n\n" + msg, "Ticket.OutlookAddIn", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message);
            }

            #endregion
        }
Esempio n. 19
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;
                    }
                }
            }
        }