Designing a Metadata-Driven SharePoint Project Library with Automated Document Set Structure

Designing a Metadata-Driven SharePoint Project Library with Automated Document Set Structure.

1. Why Start with Metadata (Not Folders)

Most SharePoint project libraries fail for one reason:

They start with folders instead of metadata.

Folders solve navigation.
Metadata solves governance.

For a scalable project portfolio library, the structure must be driven by:

  • Project ID
  • Project Year
  • Portfolio Category
  • Project Type
  • Project Status
  • Client
  • Risk Level
  • Stage Gate

This allows:

  • View filtering (Active, Closed, Government, By Year)
  • Reporting
  • Automation
  • Lifecycle management
  • Future Power BI integration

Folders alone cannot do that.


2. Core Architecture

Site

Tanolis Projects

Library

Projects

Content Type

Document Set (for each project container)


3. Core Metadata Design

Create these site columns:

ColumnType
Project IDSingle line of text
Project YearChoice
Portfolio CategoryChoice
Project TypeChoice
Project StatusChoice
ClientSingle line
Risk LevelChoice
Stage GateChoice
Start DateDate
Target End DateDate

Attach these columns to the Document Set content type, not individual files.

This ensures:

  • Each project container carries structured metadata
  • Views operate on project-level attributes
  • Documents inherit metadata if configured

4. Why Document Set (Not Just Folder)

A Document Set is:

  • A special content type
  • A container with metadata
  • A logical project object

It behaves like a folder but supports:

  • Custom metadata
  • Welcome page
  • Shared columns
  • Governance workflows

A normal folder cannot do that.


5. Required SharePoint Configuration

Enable Document Sets

Site Settings → Site Collection Features
Activate Document Sets

Then:

Library Settings → Advanced Settings
✔ Allow management of content types

Add Document Set to the library.


6. The Problem: Auto-Creating Subfolders Inside Each New Project

Goal:

When I create:

2026-003_ClientZ_NewApp

Power Automate should automatically create:

01-Contract Governance
02-Planning Design
03-Execution Delivery
04-Financials
05-Admin Closeout

Inside that Document Set.

No duplicate containers.
No root-level folder creation.
No accidental “Shared Documents” folder nesting.


7. The Correct Trigger (Important)

Use:

When a file is created (properties only)

Why?

Because:

  • A Document Set inside a document library is treated as a file/folder object.
  • “When an item is created” is for SharePoint lists.
  • Using the wrong trigger causes null content type errors and template failures.

Lock this in.


8. The Final Working Flow Design

Step 1 – Trigger

When a file is created (properties only)
Library: Projects


Step 2 – Condition

Check:

Content Type
is equal to
Document Set

No expressions.
No startsWith.
No ContentTypeId hacks.

Keep it clean.


Step 3 – Initialize Folder Array

Initialize variable:

Type: Array

[
"01-Contract Governance",
"02-Planning Design",
"03-Execution Delivery",
"04-Financials",
"05-Admin Closeout"
]

Step 4 – Apply to Each

Loop through the folder array.

Inside the loop:

Create new folder.


9. The Critical Folder Path Expression

This is where most implementations fail.

Correct expression:

concat(triggerOutputs()?['body/{Path}'], triggerOutputs()?['body/{FilenameWithExtension}'], '/', item())

Why this works:

From trigger output:

{Path} = Shared Documents/
{FilenameWithExtension} = foo set

Final path becomes:

Shared Documents/foo set/01-Contract Governance

Which means:

Folders are created inside the Document Set container — not in the root.


10. Common Mistakes (And Why They Fail)

❌ Using only Filename

concat(triggerOutputs()?['body/{FilenameWithExtension}'],'/',item())

Result:
Creates duplicate root folder or wrong nesting.


❌ Using ContentTypeId startsWith

Leads to:

startsWith expects string but got null

Because wrong trigger context.


❌ Using “When an item is created”

Causes:

  • Null content type
  • Condition failures
  • Inconsistent behavior

11. Handling Race Conditions

Sometimes folder creation hangs because:

The Document Set is not fully provisioned when the flow runs.

Solution:

Add a small Delay (5 seconds minimum on consumption plan).

Or use retry policy.


12. Optional Enhancements

You can extend this design to:

  • Auto-assign permissions based on Portfolio Category
  • Notify PM when project is created
  • Trigger approval workflow at Stage Gate change
  • Auto-create Teams channel per project
  • Sync metadata to Dataverse

13. Architectural Pattern Summary

What you built is:

✔ Metadata-first design
✔ Document Set container model
✔ Automated structural provisioning
✔ Governance-ready foundation

This scales to:

  • 10 projects
  • 100 projects
  • 1,000 projects

Without structural drift.


14. Final Design Philosophy

Folders are operational.
Metadata is strategic.

Document Sets give you both.

Power Automate enforces consistency.

FavoriteLoadingAdd to favorites

Author: Shahzad Khan

Software developer / Architect

Leave a Reply