Skip to main content

useCASharePointNotificationCenter

@spartanfx/react v1.2.2


@spartanfx/react / codeapps / useCASharePointNotificationCenter

Function: useCASharePointNotificationCenter()

function useCASharePointNotificationCenter(config): INotificationCenterHook;

Power Apps Code Apps NotificationCenter hook backed by SharePoint.

Consumes a generated <ListName>Service from pac code add-data-source targeting the SharePoint connector (shared_sharepointonline).

Configuration

Required

PropertyTypeDescription
serviceICATabularService<CANotificationRecord, string>Generated SharePoint-list service produced by pac code add-data-source -a shared_sharepointonline -t <ListName> -d <siteUrl>. Typically located under src/generated/services/<ListName>Service.ts.

Options

PropertyTypeDescription
choiceColumns?string[]SharePoint Choice / Lookup / Person column names that must be sent as the expanded reference object on create/update. Defaults to [schema.level] (typically ["Level"]) so the standard Level Choice column on the SharePoint Notifications list works without additional configuration. See: https://learn.microsoft.com/en-us/power-apps/developer/code-apps/how-to/sharepoint-operations
schema?Partial<INotificationCenterSchema>Schema mapping. Sensible defaults are applied when omitted — override only the columns the consumer's list renamed.

+ 10 inherited members. standard HTML/ARIA attributes (e.g. className, onClick, aria-*) are also accepted but omitted here for clarity.

Full type reference: IUseCASharePointNotificationCenterConfig

Returns

INotificationCenterHook

Example

import { NotificationsService } from './generated/services/NotificationsService';
import { useCASharePointNotificationCenter } from '@spartanfx/react/codeapps';

const hook = useCASharePointNotificationCenter({
service: NotificationsService,
onNotify: (level, msg) => toast[level](msg),
});
return <NotificationCenter provider={hook} />;