Knowledge Center

502 - Finding Which Documents Failed

Updated on

Finding Which Documents Failed

The ArchiveAudit join that turns a Partial Success into a list of documents and reasons.

ArchiveRequests gives you the outcome. ArchiveAudit gives you every step — one row per document processed, successes and errors both.

The query

SELECT a.DocumentId,

a.WorkspaceId,

a.ProcessedDate,

a.Error

FROM ArchiveAudit a

WHERE a.ArchiveRequestUID = @RequestUID

AND a.Error IS NOT NULL

ORDER BY a.ProcessedDate;

That returns the exact document IDs and the message for each. It is the most useful single query in this guide.

Counting what was really touched

SELECT r.UID,

r.Mode,

r.Status,

r.SuccessProcessedCount,

COUNT(a.UID) AS AuditRowCount,

SUM(CASE WHEN a.Error IS NOT NULL THEN 1 ELSE 0 END) AS Errors

FROM ArchiveRequests r

LEFT JOIN ArchiveAudit a ON a.ArchiveRequestUID = r.UID

GROUP BY r.UID, r.Mode, r.Status, r.SuccessProcessedCount

ORDER BY r.UID;

ProcessedObject

Warning ArchiveAudit.ProcessedObject records the scope of the request, not the row. A workspace archive writes one row per document and every one of them reads Workspace. Ninety-nine documents means ninety-nine rows all saying Workspace.

Deletions

Deletions do not appear in ArchiveAudit. Use DeleteArchiveAudit instead, joining DeleteRequestId to ArchiveRequests.UID and DeleteRuleId to DeleteArchiveRules.UID.

Previous Article 501 - Reading a Run
Next Article 503 - Traps to Know About