コード例 #1
0
 public override void Bang(Outlook.Application App, string Command)
 {
     switch (Command)
     {
     case "Display":
         folder.Display();
         return;
     }
 }
コード例 #2
0
        public Outlook(TimelineHandler handler)
        {
            try
            {
                //redemption prep
                //tell the app where the 32 and 64 bit dlls are located
                //by default, they are assumed to be in the same folder as the current assembly and be named
                //Redemption.dll and Redemption64.dll.
                //In that case, you do not need to set the two properties below
                DirectoryInfo currentDir = new FileInfo(GetType().Assembly.Location).Directory;
                RedemptionLoader.DllLocation64Bit = Path.GetFullPath(currentDir + @"\lib\redemption64.dll");
                RedemptionLoader.DllLocation32Bit = Path.GetFullPath(currentDir + @"\lib\redemption.dll");
                //Create a Redemption object and use it
                _log.Trace("Creating new RDO session");
                _session = RedemptionLoader.new_RDOSession();
                _log.Trace("Attempting RDO session logon...");
                _session.Logon(Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value);
            }
            catch (Exception e)
            {
                _log.Error($"RDO load error: {e}");
            }

            try
            {
                _app            = new Microsoft.Office.Interop.Outlook.Application();
                _oMapiNamespace = _app.GetNamespace("MAPI");
                _folderInbox    = _oMapiNamespace.GetDefaultFolder(OlDefaultFolders.olFolderInbox);
                _folderOutbox   = _oMapiNamespace.GetDefaultFolder(OlDefaultFolders.olFolderOutbox);
                _folderSent     = _oMapiNamespace.GetDefaultFolder(OlDefaultFolders.olFolderSentMail);
                _log.Trace("Launching Outlook");
                _folderInbox.Display();

                if (handler.Loop)
                {
                    while (true)
                    {
                        ExecuteEvents(handler);
                    }
                }
                else
                {
                    ExecuteEvents(handler);
                }
            }
            catch (Exception e)
            {
                _log.Error(e);
            }
        }
コード例 #3
0
        public void StartOutlook()
        {
            logger.Info("Trying to start Outlook");
            if (Process.GetProcessesByName("OUTLOOK").Count() == 0)
            {
                Outlook.Application outlook;
                if ((outlook = GetApplication()) == null)
                {
                    logger.Error("Outlook is not installed on this agent");
                    output.SetBusinessError("Outlook seems to not be installed on this machine. Aborting");
                    return;
                }

                Outlook.MAPIFolder inbox =
                    outlook.GetNamespace("MAPI").GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox);

                inbox.Display();
            }
        }