Beispiel #1
0
 public AppointmentInfo(AppointmentItem appointment, MAPIFolderInfo folderInfo)
 {
     Appointment = appointment;
     FolderInfo  = folderInfo;
     Subject     = appointment.Subject;
     Enabled     = true;
     ProjectInfo = new ProjectInfo(Subject);
     Project     = ProjectInfo.Name;
 }
Beispiel #2
0
        private void AddMAPIFolderToList(MAPIFolderInfo f)
        {
            ListViewItem item = new ListViewItem(f.ToString())
            {
                Checked     = true,
                ToolTipText = f.ToString(),
                Tag         = f
            };

            lvKalendare.Items.Add(item);
        }
Beispiel #3
0
 private void btOK_Click(object sender, EventArgs e)
 {
     DialogResult = DialogResult.OK;
     foreach (ListViewItem item in chlFolders.CheckedItems)
     {
         MAPIFolderInfo mapi = item.Tag as MAPIFolderInfo;
         if (mapi == null)
         {
             Log.Write($"Cannot convert folder to mapi: {item.Tag}");
         }
         Log.Write($"Adding MAPI to selected folders: {mapi.ToString()}");
         selectedFolders.Add(mapi);
     }
     Close();
 }
Beispiel #4
0
        private void Process()
        {
            if (AllMAPIFolders.Count == 0)
            {
                NameSpace ns;
                Microsoft.Office.Interop.Outlook.Application o = new Microsoft.Office.Interop.Outlook.Application();
                ns = o.GetNamespace("MAPI");
                var mapiFolder = new MAPIFolderInfo(ns.GetDefaultFolder(OlDefaultFolders.olFolderCalendar));

                AddMAPIFolderToList(mapiFolder);
            }
            this.Cursor = Cursors.WaitCursor;
            try
            {
                ProcessFolders();
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
Beispiel #5
0
        private void loadCallendars()
        {
            Log.Write("Loading callendars...");
            chlFolders.Items.Clear();

            Microsoft.Office.Interop.Outlook.Application app     = new Microsoft.Office.Interop.Outlook.Application();
            Microsoft.Office.Interop.Outlook.NameSpace   session = app.Session;
            chlFolders.BeginUpdate();

            foreach (MAPIFolder ff in session.Folders)
            {
                Log.Write($"Folder in session: {ff}");
                foreach (MAPIFolder folder in ff.Folders)
                {
                    Log.Write($"Folder {folder.FullFolderPath}");
                    if (folder.DefaultMessageClass == "IPM.Appointment")
                    {
                        Log.Write($"Folder {folder.FullFolderPath} is IPM.Appointment");
                        Log.Write($"Creating FolderInfo");
                        MAPIFolderInfo folderInfo = new MAPIFolderInfo(folder);
                        ListViewItem   li         = new ListViewItem(folderInfo.ToString());
                        Log.Write($"Created ListViewItem: {folderInfo}");
                        li.Tag = folderInfo;
                        bool check = AllMAPIFolders.Any(f => f.ToString() == folderInfo.ToString());
                        Log.Write($"ListView checked status will be: {check}");
                        li.Checked = check;
                        chlFolders.Items.Add(li);
                    }
                    else
                    {
                        Log.Write($"Folder {folder.FullFolderPath} is NOT IPM.Appointment");
                    }
                }
            }
            chlFolders.EndUpdate();
            chlFolders.Refresh();
        }
Beispiel #6
0
        private void lvKalendare_ItemChecked(object sender, ItemCheckedEventArgs e)
        {
            MAPIFolderInfo fi = e.Item.Tag as MAPIFolderInfo;

            if (fi != null)
            {
                if ((e.Item.Checked) && (!AllMAPIFolders.Any(f => f.ToString() == fi.ToString())))
                {
                    AllMAPIFolders.Add(fi);
                }
                else
                {
                    if (AllMAPIFolders.Any(f => f.ToString() == fi.ToString()))
                    {
                        AllMAPIFolders.Remove(fi);
                    }
                }

                if (fi.WasProcessed)
                {
                    foreach (ListViewItem li in lvAppointments.Items)
                    {
                        AppointmentInfo ai = li.Tag as AppointmentInfo;
                        if (ai != null)
                        {
                            if (ai.FolderInfo == fi)
                            {
                                li.Checked = e.Item.Checked;
                                ai.Enabled = e.Item.Checked;
                            }
                        }
                    }

                    recomputeTotal();
                }
            }
        }