Esempio n. 1
0
        public override void Apply(MailboxSession session, Item item)
        {
            BodyWriteConfiguration configuration = new BodyWriteConfiguration(BodyFormat.TextPlain);

            using (TextWriter textWriter = item.Body.OpenTextWriter(configuration))
            {
                string asString = AuditLogParseSerialize.GetAsString(this);
                textWriter.Write(asString);
            }
            item.ClassName = "IPM.AuditLog";
        }
Esempio n. 2
0
        private static CreateItemType GetCreateItemType(IAuditLogRecord auditRecord, BaseFolderIdType targetFolderId, out int recordSize)
        {
            string asString = AuditLogParseSerialize.GetAsString(auditRecord);
            string text     = string.Format("{0} : {1}", auditRecord.UserId, auditRecord.Operation);
            string text2    = string.Format("{0}{1}", auditRecord.UserId, "audit");
            string text3    = string.Format("{0}{1}", auditRecord.ObjectId, "audit");

            recordSize = Encoding.Unicode.GetByteCount(text) + Encoding.Unicode.GetByteCount(asString) + Encoding.Unicode.GetByteCount(text2) + Encoding.Unicode.GetByteCount(text3);
            return(new CreateItemType
            {
                MessageDisposition = MessageDispositionType.SaveOnly,
                MessageDispositionSpecified = true,
                SavedItemFolderId = new TargetFolderIdType
                {
                    Item = targetFolderId
                },
                Items = new NonEmptyArrayOfAllItemsType
                {
                    Items = new ItemType[]
                    {
                        new MessageType
                        {
                            ItemClass = "IPM.AuditLog",
                            Subject = text,
                            Body = new BodyType
                            {
                                Value = asString,
                                BodyType1 = BodyTypeType.Text
                            },
                            From = new SingleRecipientType
                            {
                                Item = new EmailAddressType
                                {
                                    Name = text2
                                }
                            },
                            ToRecipients = new EmailAddressType[]
                            {
                                new EmailAddressType
                                {
                                    Name = text3
                                }
                            }
                        }
                    }
                }
            });
        }