internal bool ExecuteSendLinkAction(MailItem mailItem, PolicyContent.Attachment[] builtup, RequestManager requestManager)
		{
			Logger.LogInfo("Executing Secure File Transfer Process");

            Workshare.Analytics.WsAnalyticsListener analyticsListener = new Workshare.Analytics.WsAnalyticsListener();
            analyticsListener.SendSendLinkStatistic();

			if (!requestManager.SendAndProtect && !ShowBccWarning(mailItem, requestManager))
            {
                return false;
            }

            try
            {
                List<PolicyContent.Attachment> listAttachments = new List<PolicyContent.Attachment>();

                if (!CreateListOfAttachmentsToSendLink(mailItem, builtup, requestManager, ref listAttachments))
                {
                    return false;
                }

        
                if (listAttachments.Count <= 0)
                {
                    Logger.LogInfo("List of attachments to SendLink is empty");
                    return true;
                }
                string id = Guid.NewGuid().ToString();
                List<SendLinkInfo> links = GetLinks(requestManager.Response, mailItem, listAttachments, id);
             


                if (links != null && links.Count > 0)
                {
					Logger.LogInfo("Secure File Transfer: removing old attachments");

                    //SetMessageWindowVisible(mailItem, false);

                    //This call will change the mailItem
                    AdjustAttachments(mailItem, links, id);


                    if (!string.IsNullOrEmpty(GetPropertyValue(requestManager.EnforceResponse.ModifiedRequest.Properties,
                                                               MailMessagePropertyKeys.MimeContent)) ||
                        !string.IsNullOrEmpty(GetPropertyValue(requestManager.EnforceResponse.ModifiedRequest.Properties,
                                                               MailMessagePropertyKeys.LargeMimeContent)))
                    {
                        string body;
                        // Need to create a new proxy object because mailItem was changed in AdjustAttachments()
                        if (UseOutlookDOMForProcessing)
                        {
                            using (OutlookMailProxy outlookMailProxy = new OutlookMailProxy(mailItem))
                            {
                                body = outlookMailProxy.FormattedBodyText;
                                body = OutlookFormattedTextProcessor.NewFormattedBodyText(body, links, mailItem);
                            }
                        }
                        else
                        {
                            using (RedemptionMailProxy redemptionMailProxy = new RedemptionMailProxy(mailItem, true, DisableAccessToDOMAttachments))
                            {
                                body = redemptionMailProxy.FormattedBodyText;
                                body = OutlookFormattedTextProcessor.NewFormattedBodyText(body, links, mailItem, false);

                                //private static void InsertHtmlIntoBodyText(ref string body, MessageBodyFormat bodyformat, IEnumerable<SendLinkInfo> links, MailItem mailItem)
                                //sets body as null.
                                if (body != null)
                                {
                                    redemptionMailProxy.FormattedBodyText = body;
                                }
                            }
                        }

                        if (body != null)
                        {
                            SetPropertyValue(requestManager.EnforceResponse.ModifiedRequest.Properties, MailMessagePropertyKeys.FormattedBody, body);
                        }
                    }

					Logger.LogInfo("End Secure File Transfer Process");

                    // Allow the inspector window to redraw now, so that the attachments
                    // and altered body text are immediately updated.
                    System.Windows.Forms.Application.DoEvents();
                }
                else
                {
                    Logger.LogInfo("No Links to process");
                }

                StartSendLinkClient();

                mailItem.UserProperties.Add("SendLink", OlUserPropertyType.olText);
            }
            catch (Exception e)
            {
                //SetMessageWindowVisible(mailItem, true);
                Logger.LogError(e);
                throw;
            }

            return true;
		}
Exemple #2
0
 private void RaiseMixpanelEvent()
 {
     try
     {
         Workshare.Analytics.WsAnalyticsListener analyticsListener = new Workshare.Analytics.WsAnalyticsListener();
         analyticsListener.SendSendLinkStatistic();
         analyticsListener.SendOutlookEventStatistic("ActionApplied", new Dictionary<string, object>()
             {
                 {"Name", "Secure File Transfer"},
                 {"Risk", "Low"}, // Risk level in 'Secure File Transfer' policy
                 {"Skipped", "False"}
             });
     }
     catch(Exception ex)
     {
         Logger.LogError(ex);
     }
 }
Exemple #3
0
 private void RaiseMixpanelEvent()
 {
     try
     {
         Workshare.Analytics.WsAnalyticsListener analyticsListener = new Workshare.Analytics.WsAnalyticsListener();
         analyticsListener.SendOutlookEventStatistic("ActionApplied", new Dictionary<string, object>()
             {
                 {"Name", "Zip"},
                 {"Risk", ""}, // No risk level if Zip is enabled in the default policy
                 {"Skipped", "False"}
             });
     }
     catch (Exception ex)
     {
         Logger.LogError(ex);
     }
 }