Skip to content

"Sharing web is blocked for Teams channel site" with m365 spo group member add #6104

@amateo

Description

@amateo

Priority

(Urgent) I can't use the CLI

Description

I am trying to write a script to modify permissions in a sharepoint site associated with a team channel. My final goal is to configure members of the channel as visitors (RO) of the SP site associate to the channel.

I have already tested with a PS script using the PnP module. With this module I can run commands like

Add-PnpGroupMember -Identity 'Visitantes de la My Sample Team-My Sample Private Channel 4' -LoginName <userUpn>

Remove-PnPGroupMember -Identity 'Visitantes de la My Sample Team-My Sample Private Channel 4' -LoginName <userUpn>

But I'd prefer to write the script using the CLI for Microsoft 365 (because I could easily integrate it in other scripts I already have).

The problem I'm having is that I could list groups in the SP site, get the members of these groups, but when I try to add members I get an error:

amateo@slimbook:~/node_modules$ m365 spo group member add --webUrl $siteUrl --groupId 4 --userNames [email protected] --verbose 
Getting group Id for SharePoint Group 4
Checking if the specified users and groups exist
Adding resource(s) to SharePoint Group 4
Error: Sharing web is blocked for Teams channel site.

I have tried using the groupId and the groupName parameters, and I get the same error in both cases. As I already said, adding the same member to the same group directly with PS works without any problem.

I have also tried to remove users from the group with m365 spo group member remove... and this command works fine. I'm having problems just with the group member add.

Steps to reproduce

  1. Create a team
  2. Try to add a member to one of its SP groups

Expected results

I expected the command spo group member add --webUrl $siteUrl --groupId 4 --userNames [email protected] --verbose to add a member to the SP group.

Actual results

I get the error:

Error: Sharing web is blocked for Teams channel site.

Diagnostics

No response

CLI for Microsoft 365 version

v7.9.0

nodejs version

v18.20.3

Operating system (environment)

Linux

Shell

bash

cli doctor

No response

Additional Info

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions