---
suivi: 1232
date: 2026-08-06
sujet: Inventaire contenu réel SharePoint chantier ENVOL (préalable verrouillage)
chantier: sharepoint / suivi-chantier
type: diagnostic
statut: poussé
hash: b6d8c67d
fichiers:
  - app/Services/SharePointService.php
  - app/Services/SharePointChantierInventaireService.php
  - app/Http/Controllers/Admin/SharePointChantierInventaireController.php
  - resources/views/admin/sharepoint-inventaire-chantier.blade.php
  - resources/views/admin/sharepoint-inventaire-chantier-show.blade.php
  - routes/web.php
  - tests/Unit/SharePointChantierInventaireServiceTest.php
  - docs/suivi/SUIVI_1232_inventaire_sharepoint_chantier.md
---

# SUIVI #1232 — inventaire SharePoint chantier

## PROMPT ENVOYÉ

Inventaire lecture seule du contenu RÉEL des dossiers chantier SharePoint
(préalable verrouillage écriture utilisateurs). Route web (Graph), programme par
programme, persistance, croisement ERP, verdicts VIDE/ERP/MIXTE/MANUEL, feuille
de route ERP manquant, instruction verrouillage sans exécution.

## FICHES LUES

- `#1230` — arborescence, dossiers vides côté ERP, route GED `contenu`, inventaire
  manuel risque n°1, route web type #1073/#1109.
- `#1231` — multi-docs marché (parallèle) ; ne pas toucher dépôt ici.
- `#1228` / `#1226` — documents marché / uploads.
- `#1109` / `#1073` — modèle déclenchement web (pas artisan).
- `#1108` — échec Graph visible, jamais « vide » silencieux.

## OBJET 1 — Outil

| Élément | Choix |
|---------|--------|
| Listage | `SharePointService::listerContenuDossierInventaire` (même `/children` que GED) |
| Orchestre | `SharePointChantierInventaireService` |
| UI | Blade admin GS_DSI / GS_ADMIN_ERP (pas de Vue / pas de build) |
| Persistance | `storage/app/inventaire_sharepoint_chantier/programme_{id}.json` — **pas de migration** (purge via POST purge) |
| Batch | `GET …/run?batch=25` ; `?reset=1` recommence ; sans reset = reprise |

### URLs

- Index : `/admin/sharepoint/inventaire-chantier`
- Run : `/admin/sharepoint/inventaire-chantier/{programme}/run?batch=25`
- Reset : `…/run?reset=1&batch=25`
- Show : `/admin/sharepoint/inventaire-chantier/{programme}`
- Agrégat : `/admin/sharepoint/inventaire-chantier/aggregate`
- Purge JSON : `POST …/purge?programme={id}` (ou sans id = tout)

Scopes parcourus : `05_SUIVI_CHANTIER` + `00_COMITES_ENGAGEMENT` (profondeur complète).

## OBJET 2 — Tableau verdicts (à remplir après runs prod)

| Dossier | Verdict | Notes |
|---------|---------|-------|
| `05_SUIVI_CHANTIER/5_PHOTOS` | *après inventaire* | Suspect dépôt manuel |
| `05_SUIVI_CHANTIER/4_TAXES` | *après inventaire* | |
| `05_SUIVI_CHANTIER/DCE` | *après inventaire* | dce_* ERP = 0/3 |
| `05_SUIVI_CHANTIER/DOSSIER_MARCHE` | *après inventaire* | Robin veut garder |
| `05_SUIVI_CHANTIER/PRESTATAIRES` | *après inventaire* | doublon de 1_ |
| `05_SUIVI_CHANTIER/3_CONCESSIONNAIRES` | *après inventaire* | |
| `05_SUIVI_CHANTIER/**/02_FACTURES` | *après inventaire* | 0 doc ERP |
| `00_COMITES_ENGAGEMENT` (+ 5 enfants) | *après inventaire* | hors chantier, bonus |

Colonnes inventaire dossier : programme, chemin, nb fichiers, nb sous-dossiers,
taille, date plus récente, createdBy, status ok/error.

Fichier : `connu_erp` via croisement `marche_documents` / `avenant_documents` /
`appels_offres.dce_*` / `estimatif_*` / `ao_devis` / `reservation_documents.fichier_url`.

## OBJET 4 — Feuille de route ERP (ne pas implémenter)

À préciser après verdicts prod. Canevas :

| Manque | Dossier SP | Volume | Emplacement ERP proposé |
|--------|------------|--------|-------------------------|
| Photos chantier | `5_PHOTOS` | *mesure* | Module suivi chantier / GED dédiée |
| Taxes | `4_TAXES` | *mesure* | À définir métier |
| DCE manuel | `DCE/` | *mesure* | Module AO (`1_DCE`) |
| Contenu DOSSIER_MARCHE | `DOSSIER_MARCHE` | *mesure* | À définir (Robin conserve le dossier) |
| Fusion PRESTATAIRES | `PRESTATAIRES` | *mesure* | Migration vers `1_`/`4_PRESTATAIRES` |

## OBJET 5 — Verrouillage (instruit, non exécuté)

- **Niveau** : bibliothèque `PROGRAMMES` (ou dossiers racine programme) — permissions
  SharePoint / site ; Graph ne gère pas le verrouillage dans ce lot.
- **Compte à préserver** : app registration Azure (`services.azure.client_id`) +
  token applicatif `GraphApiService::getAppAccessToken` (client_credentials) **et/ou**
  token délégué utilisateur selon le flux d’upload ERP (`getAccessToken`).
  Vérifier dans le diagnostic admin quels tokens sont utilisés pour l’écriture.
- **Chemins d’écriture qui cassent si verrou trop tôt** : GED upload
  (`GedController::uploadFichiers`), dépôt documents marché/avenant, AO DCE/devis,
  drop Outlook GED, dépôt manuel explorateur SharePoint / Teams, sync éventuelle.
- **Test** : un seul programme d’abord (ex. id 4 ou 10).
- **Réversibilité** : réattribuer Contribute aux groupes métier.
- **Conséquence** : ERP = SPOF documentaire si indisponible.

## DÉPLOIEMENT

```text
git pull origin main
php artisan route:clear
php artisan view:clear
```

Pas de migrate. Pas de journal (écran admin DSI uniquement).

## LEÇON

Échec Graph ≠ dossier vide. Inventaire = web only. Persistance fichier évite
migration pour un outil de diagnostic. Verdicts = décision suppression / maintien.
