# Update Email Metadata Job

Repairs the content type and extracted metadata (sender, recipients, subject, etc.) of .msg/.eml files already stored in SharePoint.

Configuration class: UpdateEmailMetadataJobCfg (SharepointCfg.UpdateEmailMetadataJob)

Schedule base: EveryNightScheduleCfg, but runs once daily at a single fixed time rather than a random time within the night window.

This job is separate from Update Document Metadata, which applies general configurable metadata rules — this job specifically targets email files and re-parses them to (re)populate email-specific metadata and content type.

# Purpose

Emails imported outside the normal migration/provisioning flow (or affected by a parsing issue at import time) can end up with the wrong content type or missing sender/recipient metadata. This job finds such files via search and repairs them.

# Configuration

# Enabled

  • Type: bool
  • Default: false
  • Description: The job does not run at all unless this is enabled.

# StartTime

  • Type: TimeSpan?
  • Default: 21:00:00
  • Description: Time of day the job runs. The job does not run at all if this is not set.

# EndTime

  • Type: TimeSpan?
  • Default: 06:00:00
  • Description: Time of day after which the job stops processing further pages of search results, even if unfinished — the run resumes where it left off on subsequent scheduled runs since matching files are found again by search.

# SearchForWrongContentType

  • Type: bool
  • Default: true
  • Description: When enabled, includes .msg/.eml files whose content type is not the configured email content type in the search criteria.

# SearchForNoEmailMetaData

  • Type: bool
  • Default: true
  • Description: When enabled, includes .msg/.eml files with no DMSSender value in the search criteria.

# AdditionalSearchCriteria

  • Type: string
  • Default:
  • Description: Extra SharePoint search query text, ANDed onto the base query. Example: "DMSMatterCode:10332" to limit the job to a single matter while testing.

# ForceMetaDataUpdate

  • Type: bool
  • Default: false
  • Description: When enabled, metadata is re-extracted and the content type is reset for every matching file on every run, even if the SMTPFrom column already has a value. When disabled (default), metadata is only re-extracted when SMTPFrom is empty or was previously marked Invalid.

# How It Works

  1. Runs a SharePoint search for .msg/.eml files, combined with the DMS Configuration's global search filter and AdditionalSearchCriteria, further restricted by SearchForNoEmailMetaData and/or SearchForWrongContentType (either condition qualifies a file for reprocessing), sorted by matter code.
  2. Pages through results (500 per page), stopping early once EndTime is reached.
  3. For each matching file, ensures the email content type is present on its document library, then sets the file's content type to the configured email content type.
  4. Re-extracts metadata (sender, recipients, subject, etc. from the .msg/.eml content) when ForceMetaDataUpdate is true, or when the file's SMTPFrom column is empty or equals Invalid.
  5. If the file cannot be parsed (corrupt or unsupported format), SMTPFrom is set to Invalid instead of being left empty. This lets a permanently unparseable file be distinguished from one that simply hasn't been processed yet, since a fresh parse attempt is not re-triggered just because a value happens to be present.

Soft limit of ~5 concurrent; beyond that a run waits up to ~1 hour, then proceeds regardless.

Last Updated: 7/7/2026, 1:48:24 PM