---
phase: 04-bulk-operations-and-provisioning
plan: 09
subsystem: ui
tags: [wpf, mvvm, community-toolkit, datagrid, csv, bulk-operations]

requires:
  - phase: 04-bulk-operations-and-provisioning
    provides: IBulkMemberService, IBulkSiteService, IFolderStructureService, ICsvValidationService, BulkResultCsvExportService, ConfirmBulkOperationDialog
provides:
  - BulkMembersViewModel with CSV import/validate/preview/confirm/execute/retry/export flow
  - BulkSitesViewModel with same flow for site creation
  - FolderStructureViewModel with site URL + library inputs + folder CSV flow
  - BulkMembersView XAML + code-behind wiring ConfirmBulkOperationDialog
  - BulkSitesView XAML + code-behind
  - FolderStructureView XAML + code-behind with SiteUrl and LibraryTitle TextBox inputs
affects: [04-10]

tech-stack:
  added: []
  patterns:
    - FeatureViewModelBase pattern extended for CSV-based bulk tabs (same as Phase 2/3 VMs)
    - ShowConfirmDialog Func<string,bool> wired in code-behind — dialog factory pattern preserving VM testability

key-files:
  created:
    - SharepointToolbox/ViewModels/Tabs/BulkMembersViewModel.cs
    - SharepointToolbox/ViewModels/Tabs/BulkSitesViewModel.cs
    - SharepointToolbox/ViewModels/Tabs/FolderStructureViewModel.cs
    - SharepointToolbox/Views/Tabs/BulkMembersView.xaml
    - SharepointToolbox/Views/Tabs/BulkMembersView.xaml.cs
    - SharepointToolbox/Views/Tabs/BulkSitesView.xaml
    - SharepointToolbox/Views/Tabs/BulkSitesView.xaml.cs
    - SharepointToolbox/Views/Tabs/FolderStructureView.xaml
    - SharepointToolbox/Views/Tabs/FolderStructureView.xaml.cs
  modified: []

key-decisions:
  - "BulkMembersViewModel passes _currentProfile.ClientId to AddMembersAsync — IBulkMemberService signature requires clientId for Graph API authentication; plan code omitted this parameter"
  - "Duplicate standalone converter files (EnumBoolConverter.cs, StringToVisibilityConverter.cs, ListToStringConverter.cs) removed — these classes already exist in IndentConverter.cs which is the established project pattern"

patterns-established:
  - "Bulk tab pattern: ImportCsvCommand -> ParseAndValidate -> PreviewRows ObservableCollection -> ShowConfirmDialog Func -> RunOperationAsync -> HasFailures -> RetryFailedCommand + ExportFailedCommand"
  - "FolderStructureViewModel overrides TenantProfile with site URL for new ClientContext — established pattern from StorageViewModel/SearchViewModel"

requirements-completed:
  - BULK-02
  - BULK-03
  - BULK-04
  - BULK-05
  - FOLD-01
  - FOLD-02

duration: 15min
completed: 2026-04-03
---

# Phase 4 Plan 9: BulkMembersViewModel + BulkSitesViewModel + FolderStructureViewModel + Views Summary

**Three CSV bulk-operation tabs with import/validate/preview/confirm/execute/retry/export flows, each wired to its respective service via FeatureViewModelBase pattern**

## Performance

- **Duration:** 15 min
- **Started:** 2026-04-03T08:18:00Z
- **Completed:** 2026-04-03T08:33:00Z
- **Tasks:** 2 (committed together per plan spec)
- **Files modified:** 9 created

## Accomplishments
- Three ViewModels following identical CSV bulk-operation flow with service-specific execution logic
- Three XAML Views with DataGrid preview, localization bindings, and ConfirmBulkOperationDialog wiring
- FolderStructureView adds site URL and library title TextBox inputs not in other bulk tabs
- Build verified clean (warnings only, no errors) after fixing pre-existing duplicate converter issue

## Task Commits

1. **Tasks 1+2: ViewModels + Views** - `fcd5d1d` (feat) — all 9 files in single commit per plan spec

## Files Created/Modified
- `SharepointToolbox/ViewModels/Tabs/BulkMembersViewModel.cs` - Bulk Members tab VM with Graph/CSOM member add flow
- `SharepointToolbox/ViewModels/Tabs/BulkSitesViewModel.cs` - Bulk Sites tab VM for site creation
- `SharepointToolbox/ViewModels/Tabs/FolderStructureViewModel.cs` - Folder Structure tab VM with site URL + library inputs
- `SharepointToolbox/Views/Tabs/BulkMembersView.xaml` - Bulk Members XAML with DataGrid preview
- `SharepointToolbox/Views/Tabs/BulkMembersView.xaml.cs` - Code-behind wiring ShowConfirmDialog
- `SharepointToolbox/Views/Tabs/BulkSitesView.xaml` - Bulk Sites XAML
- `SharepointToolbox/Views/Tabs/BulkSitesView.xaml.cs` - Code-behind wiring ShowConfirmDialog
- `SharepointToolbox/Views/Tabs/FolderStructureView.xaml` - Folder Structure XAML with site/library inputs
- `SharepointToolbox/Views/Tabs/FolderStructureView.xaml.cs` - Code-behind wiring ShowConfirmDialog

## Decisions Made
- BulkMembersViewModel passes `_currentProfile.ClientId` to `AddMembersAsync` — the IBulkMemberService interface requires this for Graph API client creation; the plan code omitted it, requiring adaptation.
- Duplicate standalone converter files removed — EnumBoolConverter.cs, StringToVisibilityConverter.cs, ListToStringConverter.cs were untracked files from a previous plan session that duplicated classes already in IndentConverter.cs.

## Deviations from Plan

### Auto-fixed Issues

**1. [Rule 3 - Blocking] Fixed duplicate converter class definitions blocking compilation**
- **Found during:** Task 1 (first build verification)
- **Issue:** Three untracked standalone converter files (EnumBoolConverter.cs, StringToVisibilityConverter.cs, ListToStringConverter.cs) duplicated classes already defined in IndentConverter.cs, causing CS0101 errors
- **Fix:** Deleted the three standalone files; IndentConverter.cs remains the single source of all converter classes (established project pattern)
- **Files modified:** Deleted SharepointToolbox/Views/Converters/EnumBoolConverter.cs, StringToVisibilityConverter.cs, ListToStringConverter.cs
- **Verification:** Build produces 0 errors (only pre-existing CS8602 nullable warnings in CsvValidationService)
- **Committed in:** fcd5d1d (Task 1+2 commit)

**2. [Rule 1 - Bug] BulkMembersViewModel passes clientId to AddMembersAsync**
- **Found during:** Task 1 implementation
- **Issue:** Plan code called `_memberService.AddMembersAsync(ctx, _validRows, progress, ct)` but IBulkMemberService signature requires `string clientId` parameter after ctx
- **Fix:** Call site updated to `_memberService.AddMembersAsync(ctx, _currentProfile.ClientId, _validRows, progress, ct)`
- **Files modified:** SharepointToolbox/ViewModels/Tabs/BulkMembersViewModel.cs
- **Verification:** Build compiles clean
- **Committed in:** fcd5d1d (Task 1+2 commit)

---

**Total deviations:** 2 auto-fixed (1 blocking, 1 bug)
**Impact on plan:** Both fixes necessary for correctness. No scope creep.

## Issues Encountered
None beyond the two auto-fixed items above.

## User Setup Required
None - no external service configuration required.

## Next Phase Readiness
- All three bulk-operation ViewModels and Views complete
- Plan 04-10 (DI registration + MainWindow wiring) can now register and integrate these Views
- No blockers

---
*Phase: 04-bulk-operations-and-provisioning*
*Completed: 2026-04-03*
