Forum Discussion

reshmeeauckloo's avatar
reshmeeauckloo
Brass Contributor
Jan 29, 2024

Unable to run set-sposite -Disablesharingfornonowners

Running the SPO PowerShell

```PowerShell

$AdminSiteURL= "https://reshmeeauckloo-admin.sharepoint.com"
$SiteURL= "https://reshmeeauckloo.sharepoint.com/sites/testclone2"

#Connect to SharePoint Online services
Connect-SPOService -url $AdminSiteURL

#Disable Sharing for Non-Owners
Set-SPOSite -Identity $SiteURL -DisableSharingForNonOwners

```
set-pnpsite -Disablesharingfornonowners
Set-PnPSite: The type of data at position 3330 is different than the one expected.

8 Replies

  • reshmeeauckloo Are you trying it using both SPO PowerShell and PnP PowerShell?

     

    Error message you shared is for PnP PowerShell. Is it throwing same error using SPO PowerShell as well?

     

    Make sure you are using SharePoint Online Management Shell Version 16.0.4613.1211 or later while using SPO PowerShell.

     

    Example: 

     

    Set-SPOSite -Identity https://contoso.sharepoint.com/sites/mysite -DisableSharingForNonOwners

     

    DocumentationSet-SPOSite 


    Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.

    • artlavxv's avatar
      artlavxv
      Copper Contributor

      ganeshsanap, thank you for this information, as you provided Documentation link we can see this is a official Microsoft announcement. My question is where I can find this famous SharePoint Online Management Shell Version 16.0.4613.1211 ?? As on Microsoft official download site is unavailable same as on other pwsh repository, I cannot find nothing about this version of SPO management shell. Would you be so kind and share how\from where I can download mentioned above SPO shell. 

       

      I will be grateful for help 

    • reshmeeauckloo's avatar
      reshmeeauckloo
      Brass Contributor
      Upgrading SPO PowerShell to the latest resolved the issue. I could reproduce the issue with both PnP PowerShell and SPO PowerShell. I could still reproduce the issue with PnP PowerShell.
      • ganeshsanap's avatar
        ganeshsanap
        MVP

        reshmeeauckloo Great, glad it worked using latest version of SPO PowerShell.

         

        Maybe something changed in SharePoint backend which is not yet updated in PnP PowerShell command. So I will suggest you to raise a new issue at: PnP PowerShell Issues.


        Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.

Resources