Esempio n. 1
0
		private bool ExecuteSendLinkAction(MailItem mailItem, Attachment[] builtup, RequestManager requestManager)
		{
			try
			{               
			    Cursor.Current = Cursors.WaitCursor;

				OutlookSendLink sendLink;
				// For Office version prior to 2010 we need access properties and attachments via MAPI
                if (!UseOutlookDOMForProcessing || OutlookVersion.Convert(m_application.Version) <= OutlookVersion.Version.Outlook2007)
				{
					sendLink = new OutlookSendLinkMAPI();
				}
				else
				{
					sendLink = new OutlookSendLinkOOM();
				}

                if (IsDeterministicSendEnabled)
                {
                    var prSearchBytes = mailItem.PropertyAccessor.GetProperty(MAPIStringDefines.PR_SEARCH_KEY);
                    var prSearchKey = Convert.ToBase64String(prSearchBytes);
                    DeferredSendStore.Add(prSearchKey);
                }

				bool result = sendLink.ExecuteSendLinkAction(mailItem, builtup, requestManager);
				
				if (result && IsDeterministicSendEnabled)
				{
					sendLink.SetDeterministicSendDeferedTime(mailItem);
				}
				return result;
			}
			finally
			{
				Cursor.Current = Cursors.Default;
			}
		}
Esempio n. 2
0
		public void TestOutlookSendLinkOOM_ReplaceAttachments()
		{
			SendLinkInfo sendLink = new SendLinkInfo();
			sendLink.DisplayName = "Attachments.html";
			sendLink.Link = "A Link";
			sendLink.FilePath = Path.Combine(TestRoot, "Attachments.html");
			OutlookEmailWrapper email = new OutlookEmailWrapper(_outlookSession, Path.Combine(TestRoot, "Test Rtf 2010.msg"));
			OutlookSendLinkOOM oom = new OutlookSendLinkOOM();
			int count = email.MailItem.Attachments.Count;
			int[] posArray = new int[count];
			string[] recordKeyArray = new string[count];

			using (var wsMailItem = new WsMailItem(email.MailItem))
			{
				for (int i = 1; i <= count; i++)
				{
					posArray[i - 1] = wsMailItem.Attachments[i].Position;
					recordKeyArray[i - 1] = oom.GetRecordKey(wsMailItem, i);
				}

				for (int i = 1; i <= count; i++)
				{
					oom.ReplaceAttachments(wsMailItem, recordKeyArray[i - 1], sendLink);
				}

				int[] posArray2 = new int[wsMailItem.Attachments.Count];
				string[] names = new string[count];
				for (int i = 1; i <= wsMailItem.Attachments.Count; i++)
				{
					posArray2[i - 1] = wsMailItem.Attachments[i].Position;
					names[i - 1] = wsMailItem.Attachments[i].DisplayName;
				}

				for (int i = 0; i < wsMailItem.Attachments.Count; i++)
				{
					Assert.AreEqual(posArray[i], posArray2[i]);
					Assert.AreEqual(names[i], "Attachments.html");
				}
			}
		}
Esempio n. 3
0
		private Int64 GetTotalAttachmentSize(MailItem mailItem)
		{
			MessageBodyFormat bodyFormat;

            if (UseOutlookDOMForProcessing)
            {
                using (OutlookMailProxy outlookMailProxy = new OutlookMailProxy(mailItem))
                {
                    bodyFormat = OutlookBodyFormat.GetMessageBodyFormat(outlookMailProxy.FormattedBodyText);
                }
            }
            else
            {
                using (RedemptionMailProxy redemptionMailProxy = new RedemptionMailProxy(mailItem, true, DisableAccessToDOMAttachments))
                {
                    bodyFormat = OutlookBodyFormat.GetMessageBodyFormat(redemptionMailProxy.FormattedBodyText);
                }
            }

            if (!UseOutlookDOMForProcessing || OutlookVersion.Convert(m_application.Version) < OutlookVersion.Version.Outlook2007)
			{
                var mapi = new OutlookSendLinkMAPI() { UseOutlookDOMForProcessing = UseOutlookDOMForProcessing, DisableAccessToDOMAttachments = DisableAccessToDOMAttachments };
				return mapi.GetTotalAttachmentSize(mailItem, bodyFormat);
			}
            else
            {
                var oom = new OutlookSendLinkOOM() { UseOutlookDOMForProcessing = UseOutlookDOMForProcessing, DisableAccessToDOMAttachments = DisableAccessToDOMAttachments };
			    return oom.GetTotalAttachmentSize(mailItem, bodyFormat);
            }
		}