public void TestFixtureSetUp()
		{
			_sender = new EmailSender();
			_app = _sender.Initialise();
			_outlookSession = _app.Session;
			_outlookSession.Logon("Outlook", "", false, true);
		}
		public void TestFixtureSetUp()
		{
			m_sender = new EmailSender();

			m_app = m_sender.Initialise();

			m_outlookSession = m_app.Session as Outlook.NameSpace;
			m_outlookSession.Logon("Outlook", "", false, true);
#if DEBUG
			m_manifestPath = Workshare.TestUtils.TestFileUtils.MakeRootPathAbsolute(@"\Win32\debug\Workshare.RegFreeCom.manifest");
#else
			m_manifestPath = Workshare.TestUtils.TestFileUtils.MakeRootPathAbsolute(@"\Win32\release\Workshare.RegFreeCom.manifest");
#endif

		}
Example #3
0
		public EmailMessageHelper(string pstFile, string rootFolderName)
		{
			m_sender = new EmailSender();
			m_app = m_sender.Initialise();

			//Create a copy of the PST file and only work with the copy.
			m_pstCopy = String.Format("{0}{1}COPY.PST",
                                        Path.GetTempPath(),
										Path.GetFileNameWithoutExtension(pstFile));
			
			File.Copy(pstFile, m_pstCopy, true);
			Assert.IsTrue( File.Exists( m_pstCopy ));

			m_mounter = new MailFolderMounter(m_app, m_pstCopy);

			MSOutlook.Folders folders = m_mounter.ETFolder.Folders;
			using (new ComObjectGovernor(folders))
			{
				m_rootFolder = folders[rootFolderName];
				Assert.IsNotNull(m_rootFolder, "Cannot find the folder containing the test emails");
			}
		}
        public void TestOpenDocumentWithEnvelopeWithOutlookOpen()
        {
            EmailSender sender = new EmailSender(); //NOT sending any email; Just using to wrap the application
            try
            {
                Outlook._Application outlookApplication = sender.Initialise() as Outlook._Application;

                using (WordApplicationController applicationController = new WordApplicationController(true))
                {
                    applicationController.CreateHostApplication(2000);
                    Word._Application application = (Word._Application)applicationController.HostApplication;

                    object officeDocument = null;
                    try
                    {
                        Outlook.MailItem mailItem = (Outlook.MailItem)outlookApplication.CreateItem(Outlook.OlItemType.olMailItem);
                        officeDocument = applicationController.OpenDocument(m_testPath + "TestEnvelope.doc", false);
                        Assert.IsNotNull(officeDocument);
                    }
                    finally
                    {
                        if (null != officeDocument)
                            Marshal.ReleaseComObject(officeDocument);

                        officeDocument = null;
                    }
                }
            }
            finally
            {
                sender.FinishWith();
            }
        }