public override MeasureResult Select(Rainmeter.Settings.InstanceSettings Instance)
        {
            string select = Instance.INI_Value("Select");

            if (select == "Subfolders")
            {
                MAPIFolderListResult result = new MAPIFolderListResult();
                result.AddRoot(folder, false);
                return(result);
            }
            return(base.Select(Instance));
        }
        public override MeasureResult Select(Rainmeter.Settings.InstanceSettings Instance)
        {
            string select = Instance.INI_Value("Select");

            if (select == "Root")
            {
                MAPIFolderListResult result = new MAPIFolderListResult();
                foreach (MAPIFolderResult root in roots)
                {
                    result.Add(root);
                }
                return(result);
            }
            return(this);
        }
        private MeasureResult GetMAPIFolders(Rainmeter.Settings.InstanceSettings Instance)
        {
            MAPIFolderListResult result = new MAPIFolderListResult();
            string rootList             = Instance.INI_Value("Root");

            if (rootList.Length == 0)
            {
                rootList = "Inbox";
            }
            Outlook.NameSpace nsMapi = outlook.GetNamespace("MAPI");
            foreach (string root in rootList.Split('|'))
            {
                if (!root.StartsWith("\\"))
                {
                    switch (root)
                    {
                    case "Inbox":
                        Outlook.MAPIFolder inbox = nsMapi.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox);
                        result.AddRoot(inbox);
                        break;

                    default:
                        return(new ErrorResult(-1, root + " not implemented"));
                    }
                }
                else
                {
                    Outlook.MAPIFolder folder = FindRoot(nsMapi.Folders, root);
                    if (folder == null)
                    {
                        return(new ErrorResult(-1, root + " not found"));
                    }
                    result.AddRoot(folder);
                }
            }
            return(result);
        }