Ejemplo n.º 1
0
        public MailAttachmentTransform(int recurseDepth, MsOutlook._Application olApplication, bool disableAccessToDOMAttachments = false)
		{
			if (recurseDepth > AbsoluteMailNestingDepth || recurseDepth < 0)
				throw new ArgumentException(string.Format(System.Globalization.CultureInfo.InvariantCulture,
					"Only supports a nesting level between 0 and {0}", AbsoluteMailNestingDepth), "recurseDepth");
			m_application = olApplication;
			m_nestingLimit = recurseDepth;
			if (m_application == null)
			{
				try
				{
					m_application = new WsApplication(new MsOutlook.Application(), false);
				}
				catch (COMException)
				{
					Thread.Sleep(1000);
                    m_application = new WsApplication(new MsOutlook.Application(), false);
				}
			}

            if (disableAccessToDOMAttachments)
            {
				m_mat = Oif.CreateWSMailAttachmentTransform();
            }
			else
            {				
				m_mat = Oif.CreateOOMWSMailAttachmentTransform();
            }
			m_mat.OutlookApp = m_application;
		}
Ejemplo n.º 2
0
		protected virtual void Dispose(bool disposing)
		{
            if (m_application != null)
            {
                ((WsApplication)m_application).Dispose();
                m_application = null;
            }

			if (m_mat != null)
			{
				m_mat.Dispose();
				m_mat = null;
			}

		}