GDG-SPFx-Bridge 1.4.8Public API 1.0 · Browser/SPFx Protocol 3
.NET first

Write C#. The Bridge handles SharePoint interoperability.

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.

API surface

Main areas

AreaAPIPurpose
ContextContext, Token, Appearance, HostImmutable snapshots of the session context.
REST server-sideRestSame-origin REST with token refresh and 401 retry.
CSOMCreateClientContextAsync / ExecuteQueryAsyncClientContext authenticated with the current token.
Host interactionHostApi.Navigation / Dialogs / Notifications / LayoutCommands executed by SPFx in the host page.
Host HTTPSharePointApi / Graph / CustomApiSPHttpClient, MSGraphClientV3 and AadHttpClient.
ListViewListViewTyped state, LastAction and capability-driven source round-trip.
Local routingRoutesSemantic routes within the Wisej session.
Page routingHostApi.ApplicationRoutingDispatch to one or more Hosts registered on the page.
DiagnosticsDiagnostics.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.

C# examples

From SharePoint context to native dialogs

The following examples illustrate the programming model defined by the technical baseline.

Initialization

using GDGSPFxBridge;

SharePointBridge.Initialize(options =>
{
    options.ApplyAdaptiveTheme = true;
    options.ThrowOnDispatchError = false;
});

Read the SharePoint context

var sp = SharePointBridge.Current;
var siteUrl = sp.Context?.Web?.AbsoluteUrl;
var login = sp.Context?.User?.LoginName;
var list = sp.Context?.List?.Title;

Use CSOM with the session token

var sp = SharePointBridge.Current;
using (var ctx = await sp.CreateClientContextAsync())
{
    ctx.Load(ctx.Web);
    await sp.ExecuteQueryAsync(ctx);
    var title = ctx.Web.Title;
}

SharePoint dialogs from .NET code

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.

Register an application route

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();

REST CRUD through SharePointApi

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, "*");
Demo SPFXBridgeTest

A real CRUD scenario as a reference

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.

Demo.New

Creates a new item.

Demo.Edit

Loads and updates an existing item using a typed ID.

Demo.View

Displays the item and SharePoint metadata.

Demo.Delete

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.

Deployment

Clear separation between the .NET application and the SPFx package

The SPFx toolchain is used to build the Bridge package when SPFx sources/runtime change; development of the consumer .NET application remains separate.

ArtifactWhen to rebuild
WisejSPFXWhen the Wisej demo/application changes.
GDGSPFxBridge.dllWhen the public/internal .NET library changes.
GDG-SPFx-Bridge .sppkgOnly 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.