protected override IEnumerable<string> GetListofRecordKeys(MailItem mailItem, MessageBodyFormat bodyFormat) { List<string> recordKeys = new List<string>(); try { using (IWSMail mail = Oif.CreateWSMail(mailItem)) { for (int i = 1; i <= mailItem.Attachments.Count; i++) { using (IWSAttachment attachment = mail.Attachments.Item(i)) { if (!MapiSignatureInspector.IsSignature(attachment, bodyFormat)) { recordKeys.Add(attachment.RecordKey); } } } } } catch (Exception ex) { Interop.Logging.Logger.LogError(ex); throw; } return recordKeys; }
public static bool IsSignature(Attachment attachment, MessageBodyFormat bodyFormat) { switch (bodyFormat) { case MessageBodyFormat.Html: return IsSignatureHtml(attachment); case MessageBodyFormat.Rtf: return IsSignatureRtf(attachment); } return false; }
protected internal override Int64 GetTotalAttachmentSize(MailItem mailItem, MessageBodyFormat bodyFormat) { Int64 total = 0; foreach (Attachment attachment in mailItem.Attachments) { if (!OomSignatureInspector.IsSignature(attachment, bodyFormat)) { // note: PR_ATTACH_SIZE is not accessible when the email is digitally signed TFS 9183. Can't use PropertyAccessor here. total += attachment.Size; } } return total / 1024; }
protected internal override Int64 GetTotalAttachmentSize(MailItem mailItem, MessageBodyFormat bodyFormat) { Int64 total = 0; using (var wsMailItem = Oif.CreateWSMail(mailItem)) { foreach (IWSAttachment attachment in wsMailItem.Attachments) { if (!MapiSignatureInspector.IsSignature(attachment, bodyFormat)) { total += (dynamic)attachment.GetFields(MAPIProxy.MapiDefines.PR_ATTACH_SIZE); } } } return (total / 1024); }
protected override IEnumerable<string> GetListofRecordKeys(MailItem mailItem, MessageBodyFormat bodyFormat) { var recordKeys = new List<string>(); try { for (int i = 1; i <= mailItem.Attachments.Count; i++) { if (!OomSignatureInspector.IsSignature(mailItem.Attachments[i], bodyFormat)) { dynamic attachment = mailItem.Attachments[i]; recordKeys.Add(attachment.RecordKey); } } } catch (Exception ex) { Interop.Logging.Logger.LogError(ex); throw; } return recordKeys; }
protected virtual IEnumerable<string> GetListofRecordKeys(MailItem mailItem, MessageBodyFormat bodyFormat) { throw new NotImplementedException(); }
protected internal virtual Int64 GetTotalAttachmentSize(MailItem mailItem, MessageBodyFormat bodyFormat) { throw new NotImplementedException(); }
private static void InsertHtmlIntoBodyText(ref string body, MessageBodyFormat bodyformat, IEnumerable<SendLinkInfo> links, MailItem mailItem) { var inspector = mailItem.GetInspector; if (inspector.IsWordMail()) { var document = inspector.WordEditor as Document; string folderHyperLink = links.First().Link; if (document != null && folderHyperLink != null) { Range rng = InsertEmptyParagraph(document, false); using (new ComRelease(rng)) { var filenamesSection = new StringBuilder(); foreach (SendLinkInfo sli in links.Where(sli => !string.IsNullOrEmpty(sli.DisplayName))) { filenamesSection.AppendFormat("<li>{0}</li>", sli.DisplayName); } string headerText = Workshare.Interop.Options.OptionApi.GetString("SendLinkEmailBodyText"); string clickHereText = Workshare.Interop.Options.OptionApi.GetString("SendLinkContentFileName"); string html = string.Format(Resources.SendLinkTemplate, headerText, filenamesSection.ToString(), folderHyperLink, clickHereText); string tempPath = Path.GetTempFileName(); try { using (var sw = new StreamWriter(tempPath, false, Encoding.Unicode)) { sw.Write(html); } string rangeToInsert = ""; rng.InsertFile(tempPath, rangeToInsert, false, false, false); } finally { if (File.Exists(tempPath)) { File.Delete(tempPath); } } } body = null; } } }