Cannot convert value to type "system.guid" - SharePoint ExcludeblockdownloadgroupIds

Anonymous
2023-03-07T10:26:36.9033333+00:00

Hi, I would like assistance on solving the error: Cannot convert value (xx) to type "system.guid". Guid should contain 32 digits with 4 dashes on Powershell

Some context for what I'm trying to achieve:

I would like to restrict downloading files on specific SharePoint online sites. But this should only apply to some users. Meaning, the site owners and one more group should be able to download, while one group should not be able to download files.

The complete cmdlet is:

Set-SPOSite -Identity https://siteurl -BlockDownloadPolicy $true -ExcludeBlockDownloadPolicySiteOwners $true -ExcludedBlockDownloadGroupIds ["25"]

The first two parts above worked (when used without the third one), i.e., Set-SPOSite -Identity siteurl -BlockDownloadPolicy $true -ExcludeBlockDownloadPolicySiteOwners $true (which basically restricts downloading for everyone apart from site owners)

However, the last part: -ExcludedBlockDownloadGroupId ["25"] (To exempt one group from the download restriction) does not seem to work and brings the error mentioned above. 25 is the group ID of the group I would want exempted from the restriction, as noted on the address bar on the SPO site permissions page. To be specific, this is how the Group ID appears on the permissions page address bar: https://siteurl/_layouts/15/people.aspx?MembershipGroupId=25

I know this is probably basic, but I have tried numerous options and input methods for the group ID on the PS cmdlet.

Any assistance on this will be appreciated

Microsoft 365 and Office | SharePoint | Development
Microsoft 365 and Office | SharePoint | For business | Windows
Windows for business | Windows Server | User experience | PowerShell
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Rich Matheisen 48,026 Reputation points
    2023-03-08T01:19:54.28+00:00

    My guess would be that it's a bug.

    The cmdlet may be mistakenly trying to use an ID that contains only hex characters as a GUID. Try using the actual GUID for the group, or some other acceptable form of identity (distinguishedName, sAMAccountname, etc.).

    The help for that command doesn't seem to identify what forms of ID can be used.


  2. RaytheonXie_MSFT 40,486 Reputation points Microsoft External Staff
    2023-03-08T02:29:46.0533333+00:00

    Hi @James Waweru,

    Per my test, I can reproduce your issue. As the error message says, you will need a Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).

    User's image


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.