SOLVED

Set-SPOSite <URL> is a Groups site collection. The valid parameters for this type of site collection

Occasional Contributor

I recently created a script that allows me to enable external users on some of our MS Teams.  We have most of our SharePoint sites locked down to allow only internal users, but when we enable a Team to be shared externally, I have to set the associated SharePoint site to be shared externally as well and then have the site limited to just the domain of the external user. THis script was working fine last week, but when I ran it again yesterday, I'm getting an error about invalid parameters.

 

 

 

Connect-SPOService -Url https://domain-admin.sharepoint.com -Credential $cred;
Set-SPOSite -Identity $g.SharePointSiteUrl -SharingCapability ExternalUserSharingOnly;
Set-sposite -identity $g.SharePointSiteUrl -SharingDomainRestrictionMode AllowList -SharingAllowedDomainList $emaildomain 

 

 

 

Where $g.SharePointSiteUrl is the URL of the group which we just enabled for external sharing and $emaildomain is the domain of the external users that will be using the Teams site.

 

I get an error for both Set-SPOSite instances

 

 

 

Set-SPOSite : https://xxx.sharepoint.com/sites/xxx is a Groups site collection. The valid parameters for this type of site collection are '-Identity', 
'-AllowSelfServiceUpgrade', '-DefaultLinkPermission', '-DefaultSharingLinkType', '-DenyAddAndCustomizePages', '-DisableCompanyWideSharingLinks', '-DisableSharingForNonOwners', '-LockState', '-Owner', '-ResourceQuota', '-ResourceQuotaWarningLevel', '-SandboxedCodeActivationCapability', '-SharingCapability', 
'-ShowPeoplePickerSuggestionsForGuestUsers', '-SocialBarOnSitePagesDisabled', '-StorageQuota', '-StorageQuotaReset', and '-StorageQuotaWarningLevel'.
At C:\Users\xxx\Documents\groups-allow-external-sharing.ps1:35 char:5

 

 

What I don't understand is the first time I run Set-SPOSite, I'm only passing SharingCapability, which is one of the parameters in the list of valid parameters. I also don't understand why suddenly, I can't set SharingDomainRestrictionMode or ShringAllowedDomainList on a group site when I can do so via the GUI.  And this exact script worked last week.  

 

When I first got this error, I did an update to the latest version of Microsoft.Online.SharePoint.PowerShell (16.0.19724.0) hoping it would fix the problem, but it has not.

 

** EDIT **

Sometimes this script works and sometimes it doesn't.

11 Replies

@Robbert van Andel 

I'm having the exact same issue with DenyAddAndCustomizePages.  Did you find a solution?

Mel

best response confirmed by Robbert van Andel (Occasional Contributor)
Solution

@Robbert van Andel I found the same issue and was able to fix it by updating to the latest version of the SharePoint Power Shell module. It looks like Microsoft Released a new version of the PowerShell module on 4/3. Then things started to break for us on Monday evening.

 

After I upgraded to the latest version I haven't had an issue again.

 

EDIT: The version I upgraded to is 16.0.19927.12000.

 

Hope that works for you.

Yup, the update worked. Thank you very much.

@@Robbert van Andel 

Had the same issue with the DenyAddAndCustomizePages and uninstalled/reinstalled "SharePoint Online Management Shell" and it worked.

Reinstall SharePoint Online Management Shell:

https://www.microsoft.com/en-us/download/details.aspx?id=35588

I am having the same issue for DenyAddAndCustomizePages and I also uninstalled and reinstalled Share Point Online Management Shell. I have version 16.0.20122.12000 but I am still having the same error. I am trying to enable custom script for a Group Site collection. The command works fine for classic sites. Anything I am missing here? Thanks in advance!

@Sucheta Patil 

Not sure if this will help, but when you un-install, make sure to reboot afterwards then re-install.  Also the Microsoft Tech had me use the Windows PowerShell instead of using the Windows PowerShell ISE and also running the Windows PowerShell in NON admin mode.  

@csesti-Jabil 

Thank you for your quick response. Tried the steps you mentioned but still same error. After some more research found references to article saying for group sites not all properties can be changed using the Set-SPOSite command but need to use CSOM. So going to try CSOM.