Skip to content

[BUG] Allow MemberCanShare doesn't work when Authentication with Credentials or with Multi-Factor authentication enabled #3516

Closed

Description

@ibaettigdev

Reporting an Issue or Missing Feature

I try to enable sharing for members, but i always get an Access denied error.
My Account is Global Admin and also SiteAdministrator of the SPO Site
Connect-PnPOnline "https://tenantname.sharepoint.com/sites/testsite" -interactive
If i authenticate with an Azure AD App Registration it works
Connect-PnPOnline "https://tenantname.sharepoint.com/sites/testsite" -ClientId $clientid -Thumbprint $thumbprint -Tenant $tenantid

Expected behavior

It should change the SharingSetting to SiteMembers can share files and folders also with interactive login

Actual behavior

Connect-PnPOnline "https://tenantname.sharepoint.com/sites/testsite" -interactive
$web = Get-PnPWeb -Includes MembersCanShare, AssociatedMemberGroup.AllowMembersEditMembership
$web.MembersCanShare = $true
$web.Update()
$web.Context.ExecuteQuery()

MethodInvocationException: 
Line |
   5 |  $web.Context.ExecuteQuery()
     |  ~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Exception calling "ExecuteQuery" with "0" argument(s): "Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))"

Steps to reproduce behavior

if you run this code it produces an error:

Connect-PnPOnline "https://tenantname.sharepoint.com/sites/testsite" -interactive
$web = Get-PnPWeb -Includes MembersCanShare, AssociatedMemberGroup.AllowMembersEditMembership
$web.MembersCanShare = $true
$web.Update()
$web.Context.ExecuteQuery()

if you run this code it works:

Connect-PnPOnline "https://tenantname.sharepoint.com/sites/testsite" -ClientId $clientid -Thumbprint $thumbprint -Tenant $tenantid
$web = Get-PnPWeb -Includes MembersCanShare, AssociatedMemberGroup.AllowMembersEditMembership
$web.MembersCanShare = $true
$web.Update()
$web.Context.ExecuteQuery()

What is the version of the Cmdlet module you are running?

PnP.Powershell 2.2.0

Which operating system/environment are you running PnP PowerShell on?

  • Windows
  • Linux
  • MacOS
  • Azure Cloud Shell
  • Azure Functions
  • Other : please specify

Activity

  1. ibaettigdev commented on Oct 18, 2023

    @ibaettigdev
    Author

    additional information:
    Set-PnPTenantSite -Identity "https://tenantname.sharepoint.com/sites/testsite" -DisableSharingForNonOwners:$false
    or
    Set-PnPSite -DisableSharingForNonOwners:$false
    does not work regardless of authentication

  2. ibaettigdev commented on Oct 18, 2023

    @ibaettigdev
    Author

    also the same behavior when i use the Parameter "MembersCanShare="true" in the pnp provisioning template
    works with app registration -- doesnt work with -interactive authentication
    <pnp:WebSettings NoCrawl="false" WelcomePage="SitePages/Home.aspx" CommentsOnSitePagesDisabled="false" QuickLaunchEnabled="false" SearchScope="DefaultScope" SearchBoxInNavBar="Inherit" MembersCanShare="true" />

  3. locked and limited conversation to collaborators on Oct 18, 2023
  4. converted this issue into a discussion #3519 on Oct 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions