Skip to content

Adds viva engage role member add command. Closes #6819#7219

Draft
nanddeepn wants to merge 1 commit into
pnp:mainfrom
nanddeepn:issue-6819
Draft

Adds viva engage role member add command. Closes #6819#7219
nanddeepn wants to merge 1 commit into
pnp:mainfrom
nanddeepn:issue-6819

Conversation

@nanddeepn
Copy link
Copy Markdown
Contributor

Adds viva engage role member add command. Closes #6819

Copilot AI review requested due to automatic review settings April 16, 2026 06:14
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new Viva Engage command to assign (add) a role member via Microsoft Graph, including tests and documentation, aligning the Viva Engage role management feature set.

Changes:

  • Introduces viva engage role member add Graph command supporting role/user resolution by name or id.
  • Adds Mocha test coverage for validation, successful POST behavior, and error handling.
  • Adds Docusaurus documentation page and sidebar entry for the new command.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/m365/viva/commands/engage/engage-role-member-add.ts Implements the new command and Graph POST to add a member to a role.
src/m365/viva/commands/engage/engage-role-member-add.spec.ts Adds unit tests for validation, success paths, and error handling.
src/m365/viva/commands.ts Registers the new command name constant.
docs/src/config/sidebars.ts Adds the new command doc to the Viva Engage sidebar.
docs/docs/cmd/viva/engage/engage-role-member-add.mdx Adds command reference docs, including preview warning and permissions.

Comment on lines +13 to +14
roleId: z.uuid().optional(),
roleName: z.string().optional(),
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docs advertise short options -i/-n for --roleId/--roleName (consistent with engage-role-member-list), but the command schema doesn't define these aliases. Add .alias('i') and .alias('n') (or update docs to remove the short options) so the documented CLI usage works.

Suggested change
roleId: z.uuid().optional(),
roleName: z.string().optional(),
roleId: z.uuid().alias('i').optional(),
roleName: z.string().alias('n').optional(),

Copilot uses AI. Check for mistakes.

:::warning

This command is based on a Microsoft Graph API that is currently in preview and is subject to change once the API reached general availability.
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The warning text has a grammatical error and is inconsistent with the existing engage role member docs. Consider changing "once the API reached general availability" to "once the API reaches general availability".

Suggested change
This command is based on a Microsoft Graph API that is currently in preview and is subject to change once the API reached general availability.
This command is based on a Microsoft Graph API that is currently in preview and is subject to change once the API reaches general availability.

Copilot uses AI. Check for mistakes.
@milanholemans
Copy link
Copy Markdown
Contributor

milanholemans commented Apr 16, 2026

Thanks, we'll try to review it ASAP.

@MartinM85 MartinM85 marked this pull request as draft May 14, 2026 11:21
@MartinM85 MartinM85 self-assigned this May 14, 2026
Copy link
Copy Markdown
Contributor

@MartinM85 MartinM85 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the contribution @nanddeepn 🚀

Just a few notes from my side. Please check also the comments from Copilot.

...globalOptionsZod.shape,
roleId: z.uuid().optional(),
roleName: z.string().optional(),
userId: z.uuid().optional(),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather use the isValidGuid from the validation utils. It validated also the @meId token.

}
};

await request.post(requestOptions);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The endpoint returns a response, so the command should return the response back to the user.

https://learn.microsoft.com/en-us/graph/api/engagementrole-post-members?view=graph-rest-beta&tabs=http

Suggested change
await request.post(requestOptions);
const response = await request.post(requestOptions);
await logger.log(response);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

New command: viva engage role member add

4 participants