MetaConfig
Bulk metadata for SharePoint libraries, with a backup read back before the first write and an undo that knows when someone else got there first.
- PowerShell
- Microsoft 365
Problem
A document library whose column values are wrong or missing is a search problem, a retention problem, and an audit problem at once. After a migration it is usually all three, because the files arrive and their classification does not. Fixing that by hand across thousands of sites is not viable, and bulk tools will happily write over a value a user changed that morning.
Approach
A PowerShell engine that writes column values to files already in a library, report-only until told to apply, with a backup of every value about to change read back before the first write. Around it sits a tagging workflow for CCH ProSystem fx Document migrations that matches each migrated file to its CCH record and runs on its own when the migration tool, Nomad, hands a client over.
Outcome
v0.4.6, in production since its first live engagement for a CPA firm of about 2,300 client sites. A read-only sweep afterward found about 89 percent of roughly 157,000 documents fully classified, with the gap named site by site. About 1,400 offline tests.
MetaConfig fixes document metadata in place. The engine does not upload, move, rename, or delete files. The files must already be in the library; what changes is the column values attached to them.
That constraint is the point. Most tooling that touches a document library can move content, which makes it something you schedule a change window for. MetaConfig writes column values, only the ones you asked for, and only after taking a backup it can restore from, so the worst case is a metadata change you can put back.
Why libraries end up wrong
Metadata rots quietly. A retention column gets added after ten thousand documents are already filed. A migration lands content with every managed column empty. A department renames a choice value and every historical document keeps the old one. None of this breaks anything loudly, so it sits there until search stops working, a retention policy fails to apply to the documents it was written for, or an auditor asks how you classify records and the honest answer is that most of them are not classified at all.
How a run works
- Validate. The metadata file is schema checked before any network call. Choice values are checked against the column's own options, so a value that is not on the list fails the run before a single file is opened, in a report-only run as well as an apply.
- Resolve. Target one file, a list, a folder, or a whole library, with the same values for every file or different values per file from a CSV.
- Preview. A current against proposed table prints for every field on every file. This always happens.
- Back up. On apply, the current value of every field about to change is captured to disk and read back. If the backup fails, the run aborts with nothing written.
- Apply. Only when you pass
-Apply. Results are reported per field, so one bad field does not stop the rest.
Nothing is ever cleared unless a value explicitly asks for it, and a clear
needs a second switch on top of -Apply.
Tagging a CCH migration
The first real job MetaConfig was built around is a firm moving its client documents out of CCH ProSystem fx Document into SharePoint, one site per client. The migration tool, Nomad, moves the files. MetaConfig then writes each document's CCH classification onto it as library columns: Class, Subclass, Year, Entity (the client name) and Entity ID (the CCH client number, kept as text so leading zeros survive).
The values come from the same CCH export Nomad migrated from, turned into an inventory with one row per document. Each file in a client's library is looked up in that client's inventory by its file name. One record, or several that agree, give the file its values. Records that disagree, or no record at all, leave the file untagged and listed with the reason. Only cells that differ from the library are written.
A library that lacks a chosen column gets it added, with the Choice options taken from the whole export so every site carries the same vocabulary. That is add only. Two columns that share a name, or a column of the wrong type, stop the client, because MetaConfig will not guess which one to write.
Hand-offs from Nomad
When Nomad finishes a client, it drops a small hand-off file in a shared folder. MetaConfig picks each one up in order, then scans, plans, previews and applies with no clicks.
- Attended hand-offs stop at the preview and wait for the operator to type APPLY.
- Unattended hand-offs apply on their own, but only while an approval the operator recorded for that batch is still valid. The approval names who gave it and when it expires, at most 48 hours later, and it is checked again at apply time. It never authorizes a clear or a write the backup cannot cover.
After each client, MetaConfig writes a result for Nomad and a per-file list: tagged, skipped with a reason, or failed with the engine's own message. A client that failed before anything was written can be retried from MetaConfig, attended, under its own label. A client whose apply started is never run again under that label; that is what the undo is for.
Checking the library, not the logs
The run records say what MetaConfig believed happened, and on the first live engagement they were not always right. Files the records counted as failed or unmatched turned out to be tagged. So completeness is checked by a separate, read-only sweep that reads every client site's library and judges each file on what SharePoint actually holds: tagged, partly tagged, or untagged. It covers sites MetaConfig never touched, which is how it found a group of sites whose hand-offs had been declined when an approval expired.
The undo is conflict-aware
A restore reads a backup and puts the captured values back, riding the same
writer and the same gates as any other apply, and staying report-only until you
pass -Apply.
What makes it usable a week later is that it does not assume the world stopped.
For every field it reports what was captured, what the run applied, what is live
right now, and what it intends to do about it. If someone edited that field
after the run you are undoing, it says Conflict and skips it instead of
quietly reverting their work. If putting the captured value back means clearing
a field that now has content, it says Clear and needs the same extra switch a
normal clear does. A restore is itself a write, so it backs up first.
What it refuses to do
- Write anything without
-Apply. - Touch system and versioning columns (
ID,FileRef,ContentTypeId,Created,Modified,Author,Editor, and others), even when asked to. - Accept a
Choicevalue that is not one of the column's options. There is no switch to override it. - Apply without a backup, unless you explicitly give the undo up.
- Guess between two columns that share a name.
Limitations
- Matching is by file name within one site. A file the migration renamed, to avoid two files with one name in one folder, is not matched and stays untagged.
- New uploads are not tagged. MetaConfig runs when the operator or a hand-off starts it, and only for documents in the CCH export.
- A re-run writes the CCH value back over any column that differs, including a staff member's correction. It never clears a column, and every run can be undone.
- The CCH document type is not written to any column.
- A tool written to repair duplicated columns removed both copies on its first live run. It is withdrawn, and the cause is not yet known.
Requirements
PowerShell 7.4 or newer and PnP.PowerShell 3.x. Windows PowerShell 5.1 is not supported, because PnP.PowerShell dropped it at v2.0. Interactive sign-in needs an app registration client ID; unattended runs use a certificate. The optional desktop app that runs the tagging console needs Python 3.11 or newer.
Roadmap
First live engagement done for a CPA firm of about 2,300 client sites; next is matching renamed files and closing the gaps a read-only sweep found.
Full roadmap →