Example #1
0
        public static int SerializeMailboxAuditRecord(IAuditLogRecord auditRecord, MessageItem auditMessage)
        {
            int result = 0;
            BodyWriteConfiguration configuration = new BodyWriteConfiguration(BodyFormat.TextPlain);

            using (TextWriter textWriter = auditMessage.Body.OpenTextWriter(configuration))
            {
                string asString = AuditLogParseSerialize.GetAsString(auditRecord);
                textWriter.Write(asString);
                result = Encoding.Unicode.GetByteCount(asString);
            }
            ExTraceGlobals.FaultInjectionTracer.TraceTest(2219191613U);
            auditMessage.ClassName = "IPM.AuditLog";
            return(result);
        }
Example #2
0
        public static int SerializeAdminAuditRecord(IAuditLogRecord auditRecord, MessageItem auditMessage)
        {
            int result = 0;

            auditMessage.Subject = string.Format("{0} : {1}", auditRecord.UserId, auditRecord.Operation);
            BodyWriteConfiguration configuration = new BodyWriteConfiguration(BodyFormat.TextPlain);

            using (TextWriter textWriter = auditMessage.Body.OpenTextWriter(configuration))
            {
                string asString = AuditLogParseSerialize.GetAsString(auditRecord);
                textWriter.Write(asString);
                result = Encoding.Unicode.GetByteCount(asString);
            }
            auditMessage.From = new Participant(string.Format("{0}{1}", auditRecord.UserId, "audit"), string.Empty, string.Empty);
            auditMessage.Recipients.Add(new Participant(string.Format("{0}{1}", auditRecord.ObjectId, "audit"), string.Empty, string.Empty));
            auditMessage.ClassName = "IPM.AuditLog";
            return(result);
        }