internal FailedDocument(IFailureEntry failure, string subject, string databaseName, ADUser user) : base(new SimpleProviderPropertyBag()) { this[FailedDocumentSchema.DocID] = failure.DocumentId; this[FailedDocumentSchema.EntryID] = failure.EntryId; this[FailedDocumentSchema.Database] = databaseName; this[FailedDocumentSchema.MailboxGuid] = failure.MailboxGuid; this[FailedDocumentSchema.ErrorCode] = (int)EvaluationErrorsHelper.GetErrorCode(failure.ErrorCode); this[FailedDocumentSchema.Description] = failure.ErrorDescription; this[FailedDocumentSchema.FailedTime] = failure.LastAttemptTime; this[FailedDocumentSchema.IsPartialIndexed] = failure.IsPartiallyIndexed; this[FailedDocumentSchema.AdditionalInfo] = failure.AdditionalInfo; this[FailedDocumentSchema.Subject] = subject; this[FailedDocumentSchema.FailureMode] = (failure.IsPermanentFailure ? FailureMode.Permanent : FailureMode.Transient); this[FailedDocumentSchema.AttemptCount] = failure.AttemptCount; if (user != null) { this[FailedDocumentSchema.Mailbox] = user.Name; this[FailedDocumentSchema.SmtpAddress] = user.PrimarySmtpAddress.ToString(); return; } this[FailedDocumentSchema.Mailbox] = string.Empty; this[FailedDocumentSchema.SmtpAddress] = string.Empty; }
private string GetSubject(IFailureEntry failure, StoreSession session) { if (this.subjectRetrievalEnabled && session != null) { try { using (Item item = Item.Bind(session, StoreObjectId.Deserialize(failure.EntryId))) { return((item.TryGetProperty(ItemSchema.Subject) as string) ?? string.Empty); } } catch (StoragePermanentException ex) { base.WriteWarning(ex.Message); return(string.Empty); } catch (StorageTransientException ex2) { base.WriteWarning(ex2.Message); return(string.Empty); } } return(string.Empty); }