Demo.New
Creates a new item.
The consumer application uses SharePointBridge.Current as its entry point and accesses context, REST, CSOM, Host API, ListView, routing and diagnostics through a session-scoped Public API. CRUD functions can also use the ADO.NET GDG.SharePoint.ADOProvider provider.
| Area | API | Purpose |
|---|---|---|
| Context | Context, Token, Appearance, Host | Immutable snapshots of the session context. |
| REST server-side | Rest | Same-origin REST with token refresh and 401 retry. |
| CSOM | CreateClientContextAsync / ExecuteQueryAsync | ClientContext authenticated with the current token. |
| Host interaction | HostApi.Navigation / Dialogs / Notifications / Layout | Commands executed by SPFx in the host page. |
| Host HTTP | SharePointApi / Graph / CustomApi | SPHttpClient, MSGraphClientV3 and AadHttpClient. |
| ListView | ListView | Typed state, LastAction and capability-driven source round-trip. |
| Local routing | Routes | Semantic routes within the Wisej session. |
| Page routing | HostApi.ApplicationRouting | Dispatch to one or more Hosts registered on the page. |
| Diagnostics | Diagnostics.GetSnapshot() | Point-in-time snapshot without access token. |
Data access for CRUD. Applications can implement Create, Read, Update and Delete operations using CSOM, REST or through the provider ADO.NET GDG.SharePoint.ADOProvider.
The following examples illustrate the programming model defined by the technical baseline.
using GDGSPFxBridge; SharePointBridge.Initialize(options => { options.ApplyAdaptiveTheme = true; options.ThrowOnDispatchError = false; });
var sp = SharePointBridge.Current; var siteUrl = sp.Context?.Web?.AbsoluteUrl; var login = sp.Context?.User?.LoginName; var list = sp.Context?.List?.Title;
var sp = SharePointBridge.Current; using (var ctx = await sp.CreateClientContextAsync()) { ctx.Load(ctx.Web); await sp.ExecuteQueryAsync(ctx); var title = ctx.Web.Title; }
var confirmed = await SharePointBridge.Current .HostApi.Dialogs .ConfirmAsync("Save item", "Confirm the update?", "Save", "Cancel"); if (confirmed) await SharePointBridge.Current.HostApi.Dialogs .AlertAsync("Item saved.");
Why HostApi? The dialog is rendered by the SPFx/SharePoint layer, keeping the visual experience consistent with the host page.
var bridge = SharePointBridge.Current; bridge.Routes.Map( "Demo.Edit", "demo/items/{id:int}/edit", async context => { var id = context.GetRouteValue<int>("id"); await pageEdit.LoadItemAsync(id, null, context); pageEdit.Show(); }); bridge.Routes.Start();
var api = SharePointBridge.Current.SharePointApi; var itemUrl = "_api/web/lists/getbytitle('SPFXBridgeTest')/items(42)"; // Read var read = await api.GetAsync(itemUrl + "?$select=Id,Title"); // Update with ETag var update = await api.PatchWithEtagAsync( itemUrl, new { Title = "Updated from Wisej" }, "*"); // Delete with ETag var deleted = await api.DeleteWithEtagAsync(itemUrl, "*");
The documented demo uses SharePointApi and REST, with ETags for update/delete, HostApi dialogs and read-back verification. In production applications, CRUD functions can be implemented using CSOM, REST or through the provider ADO.NET GDG.SharePoint.ADOProvider.
Creates a new item.
Loads and updates an existing item using a typed ID.
Displays the item and SharePoint metadata.
Confirms, deletes and verifies the HTTP 404 outcome.
The full SharePoint page is not reloaded after a mutation, preserving Hosts and List Actions. Refreshing only the Microsoft ListView remains subject to capabilities publicly supported by SPFx.
The SPFx toolchain is used to build the Bridge package when SPFx sources/runtime change; development of the consumer .NET application remains separate.
| Artifact | When to rebuild |
|---|---|
| WisejSPFX | When the Wisej demo/application changes. |
| GDGSPFxBridge.dll | When the public/internal .NET library changes. |
| GDG-SPFx-Bridge .sppkg | Only when SPFx sources/runtime change. |
Documented SPFx baseline: SPFx 1.23.2, Node >= 22.14 < 23, TypeScript 5.8.x, Heft and the project’s official Docker workflow.