Example #1
0
 protected override void Flag(DateTime?flagDate)
 {
     //http://www.slipstick.com/developer/code-samples/set-flag-follow-up-using-vba/
     _item.MarkAsTask(Outlook.OlMarkInterval.olMarkThisWeek);
     _item.TaskStartDate = flagDate.Value;
     _item.TaskDueDate   = flagDate.Value;
 }
Example #2
0
 internal static void FlagEmail(Outlook.MailItem mailItem)
 {
     if (IsMailItemHasFlaggedPreviousMail(mailItem) == true)
     {
         mailItem.MarkAsTask(Outlook.OlMarkInterval.olMarkNoDate);
         mailItem.Save();
     }
 }
        private void CreateToDoItemExample()
        {
            // Date operations
            DateTime today    = DateTime.Parse("10:00 AM");
            TimeSpan duration = TimeSpan.FromDays(1);
            DateTime tomorrow = today.Add(duration);

            Outlook.MailItem mail = Application.Session.
                                    GetDefaultFolder(
                Outlook.OlDefaultFolders.olFolderInbox).Items.Find(
                "[MessageClass]='IPM.Note'") as Outlook.MailItem;
            mail.MarkAsTask(Outlook.OlMarkInterval.olMarkTomorrow);
            mail.TaskStartDate = today;
            mail.ReminderSet   = true;
            mail.ReminderTime  = tomorrow;
            mail.Save();
        }
Example #4
0
        public void saveMailItem(string projectnumber)
        {
            string[] dirs = { "" };

            if (mailItem == null)
            {
                return;
            }

            try
            {
                if (System.IO.Directory.Exists(network_path))
                {
                    //finds the project dir where path ends with "*project"
                    //dirs = Directory.GetDirectories(network_path, "*" + project, System.IO.SearchOption.AllDirectories);
                    //Note:
                    // .../dir1/asdproject and .../dir1/project are also found!!

                    mailItem.SaveAs(nameBuilder(projectnumber, mailItem.Subject, dateBuilder(mailItem.SentOn), dateBuilder(DateTime.Now)));
                    //mailItem.SaveAs(dirs[0] + "\\" + nameBuilder(project, mailItem.Subject) + ".msg");
                    //mailItem.Categories = "Iktatva";
                    try
                    {
                        var customCat = "Iktatásra küldve";
                        if (Application.Session.Categories[customCat] == null)
                        {
                            Application.Session.Categories.Add(customCat, Outlook.OlCategoryColor.olCategoryColorDarkRed);
                        }

                        mailItem.Categories = customCat;
                        //mailItem.MarkAsTask(Outlook.OlMarkInterval.olMarkNoDate);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Sikertelen kategorizálás", "Sikertelen kategorizálás!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }

                    MessageBox.Show("Sikeres hálózati mentés", "Sikeresen elküldve iktatásra!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    //save file to local buffer


                    if (!Directory.Exists(local_path))
                    {
                        DirectoryInfo di = Directory.CreateDirectory(local_path);
                        di.Attributes = FileAttributes.Directory | FileAttributes.Hidden;
                    }

                    mailItem.SaveAs(nameBuilder(projectnumber, mailItem.Subject, dateBuilder(mailItem.SentOn), dateBuilder(DateTime.Now)));
                    mailItem.MarkAsTask(Outlook.OlMarkInterval.olMarkNoDate);

                    MessageBox.Show("Sikertelen hálózati mentés", "Sikertelen iktatásra küldés!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    MessageBox.Show("Sikeres lokális mentés", "Sikeresen elküldve iktatásra!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }

                (mailItem as Microsoft.Office.Interop.Outlook._MailItem).Close(Microsoft.Office.Interop.Outlook.OlInspectorClose.olSave);
            }
            catch (UnauthorizedAccessException ex)
            {
                //
                MessageBox.Show("UnauthorizedAccessException\n", "Sikertelen iktatásra küldés!\n", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (DirectoryNotFoundException ex)
            {
                //
                MessageBox.Show("DirectoryNotFoundException\n", "Sikertelen iktatásra küldés!\n", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception ex)
            {
                //
                MessageBox.Show("Exception\n" + ex.ToString(), "Sikertelen iktatásra küldés!\n", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }