# SharePoint Toolbox v2

## What This Is

A full C#/WPF rewrite of an existing PowerShell-based SharePoint Online administration and auditing tool. The app lets IT administrators manage permissions, analyze storage, search files, detect duplicates, manage site templates, and perform bulk operations across SharePoint Online and Teams sites. It's a local desktop tool used by MSPs and IT teams managing multiple client tenants.

## Core Value

Administrators can audit and manage SharePoint/Teams permissions and storage across multiple client tenants from a single, reliable desktop application.

## Requirements

### Validated

(None yet — ship to validate)

### Active

- [ ] Full C#/WPF rewrite of all existing PowerShell features
- [ ] Multi-tenant authentication with cached sessions (switch between client tenants instantly)
- [ ] Export all SharePoint/Teams accesses a specific user has across selected sites
- [ ] Simplified permissions reports (plain language, summary views, reduced jargon for untrained users)
- [ ] Storage metrics graph by file type (pie/donut and bar chart, toggleable) in Storage Metrics tab
- [ ] Thorough error handling cleanup (eliminate silent failures, proper error reporting)
- [ ] Modular architecture (separate files per feature area)
- [ ] Self-contained single EXE distribution (no .NET runtime dependency)

### Out of Scope

- Cross-platform support (Mac/Linux) — Windows-only desktop tool, MAUI/Avalonia not justified
- SQLite or database storage — JSON sufficient for config, profiles, and templates
- Web-based UI — must remain a local desktop application
- Cloud/SaaS deployment — local tool by design
- Mobile support — desktop admin tool

## Context

- **Existing codebase:** 6,400-line monolithic PowerShell script (`Sharepoint_ToolBox.ps1`) with WinForms UI
- **Current features to port:** Permissions reports, storage metrics, site templates, file search, duplicate detection, bulk operations (transfer, site creation, member addition), folder structure creation, localization (EN/FR)
- **SharePoint integration:** Currently uses PnP.PowerShell module; C# rewrite will use PnP Framework / Microsoft Graph SDK
- **Authentication:** Currently interactive Azure AD OAuth via PnP; new version needs multi-tenant session caching
- **Known issues in current app:** 38 silent catch blocks, 27 error suppressions, resource cleanup issues, UI freezes on large datasets, no operation cancellation
- **Localization:** English and French supported, key-based translation system
- **Report exports:** CSV and interactive HTML reports with embedded JS for sorting/filtering

## Constraints

- **Platform:** Windows desktop only — WPF requires Windows
- **Distribution:** Self-contained EXE (~150MB) — no .NET runtime dependency for end users
- **Auth method:** Interactive browser-based Azure AD login (no client secrets or certificates stored)
- **Data storage:** JSON files for profiles, settings, templates — same format as current app for migration
- **SharePoint API:** PnP Framework / Microsoft Graph SDK for C# (replaces PnP.PowerShell)
- **Local only:** No telemetry, no cloud services, no external dependencies at runtime

## Key Decisions

| Decision | Rationale | Outcome |
|----------|-----------|---------|
| Rewrite to C#/WPF instead of improving PowerShell | Better async/await, proper OOP, richer UI, better tooling — worth the investment for long-term maintainability | — Pending |
| WPF over WinForms | Modern data binding, MVVM pattern, richer styling for better UX | — Pending |
| Self-contained EXE | Users shouldn't need to install .NET runtime — simplifies distribution to clients | — Pending |
| Keep JSON storage | Simple, human-readable, sufficient for config/profiles — no need for SQLite complexity | — Pending |
| Multi-tenant session caching | MSP workflow requires fast switching between client tenants without re-authenticating each time | — Pending |
| Pie + bar chart toggle for storage | Gives users flexibility to view data in preferred format | — Pending |

---
*Last updated: 2026-04-02 after initialization*
