f365.user, current user and people lookup
Information about the signed-in user, group membership checks, and lookups of other users by id, login, or email.
The f365.user namespace exposes the signed-in user, their group
memberships, their permissions, and lookups of other users.
Surface
| Property | Description |
|---|---|
current() | Synchronously returns the signed-in user, id, email, loginName, displayName. |
byId(id) | Look up a user by SharePoint user id. Async. |
byLogin(login) | Look up by login name (e.g. i:0#.f|membership|user@tenant). Async. |
byEmail(email) | Look up by email address. Async. |
ensureUser(email) | Ensure the user exists in the current site collection (resolves and provisions if needed). Returns their user id. Async. |
groups() | Returns all groups (SP + Entra, transitive) the signed-in user is in. Async. |
isInGroup(name) | Sync check against the pre-loaded group list. Same signature as the expression-grammar helper. |
permissions() | Returns { high, low, has(F365PermissionKind) }. Use has() for permission gates. |
picture(idOrEmail, size?) | Sync URL builder for the user's profile picture. size: "S" | "M" | "L". |
Examples
Default the Requestor field to the current user
f365.events.onLoad(() => {
if (f365.context.displayMode === 'new') {
f365.field('Requestor').value = f365.user.current().id;
}
});
Show an extra panel only to managers
f365.events.onLoad(() => {
f365.field('ManagerNotes').visible = f365.user.isInGroup('Managers');
});
Look up a person's email by id
const requestor = await f365.user.byId(f365.field('Requestor').value);
f365.field('RequestorEmail').value = requestor.email;
Related
Related articles
- Audience trimming, group-based visibility & enable
Show, hide, enable, or disable fields based on SharePoint or Entra group membership, no code required.
- f365.context, runtime context
Read-only form context, formId, listId, itemId, displayMode, currentUser, webUrl, siteUrl.