Feb 19 2020 08:24 AM - edited Apr 08 2020 08:24 AM
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.
Apr 08 2020 05:47 AM
I'm having the exact same issue with DenyAddAndCustomizePages. Did you find a solution?
Mel
Apr 09 2020 02:37 PM
Same here.
Apr 09 2020 03:05 PM - edited Apr 09 2020 03:08 PM
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.
Apr 09 2020 03:37 PM
Updating fixed it for me too. Thanks Matt!
Apr 09 2020 04:59 PM
May 07 2020 04:00 AM
@@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
May 07 2020 10:44 AM
Obrigado !!
Jun 03 2020 12:09 PM
Jun 03 2020 01:08 PM
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.
Jun 03 2020 01:55 PM
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.
Jun 17 2020 01:41 PM
Apr 09 2020 03:05 PM - edited Apr 09 2020 03:08 PM
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.