示例#1
0
        public bool PrintMessage(string EntryID, string StoreID)
        {
            _com_Outlook_Application outlook  = null;
            _com_OutlookNameSpace    session  = null;
            _com_OutlookMailItem     mailItem = null;

            try
            {
                outlook = new _com_Outlook_Application();

                session = outlook.NameSpace;
                session.Logon( );
                mailItem = session.GetItemFromID(EntryID, StoreID);

                if (mailItem != null)
                {
                    mailItem.PrintOut();
                }
                return(true);
            }
            catch (Exception exception)
            {
                ReportProblem(exception);
            }
            finally
            {
                COM_Object.ReleaseIfNotNull(mailItem);
                COM_Object.ReleaseIfNotNull(session);
                COM_Object.ReleaseIfNotNull(outlook);
            }
            return(false);
        }
示例#2
0
            private _com_OutlookMailItem GetItemFromID(string EntryID, string StoreID)
            {
                OutlookGUIInit.StartAndInitializeOutlook();
                _com_Outlook_Application outlook = null;
                _com_OutlookNameSpace    session = null;

                try
                {
                    outlook = new _com_Outlook_Application();
                    session = outlook.NameSpace;
                    return(session.GetItemFromID(EntryID, StoreID));
                }
                catch (Exception exception)
                {
                    ReportProblem(exception);
                }
                finally
                {
                    COM_Object.ReleaseIfNotNull(session);
                    COM_Object.ReleaseIfNotNull(outlook);
                }
                return(null);
            }