msgraph-sdk-powershell icon indicating copy to clipboard operation
msgraph-sdk-powershell copied to clipboard

Grant-MgSitePermission has invalid suffix in called URI

Open JustinGrote opened this issue 3 years ago • 1 comments

grant-mgsitepermission -permissionid 'read' -siteid 'hello' -verbose -debug Debug URI Result: https://graph.microsoft.com/v1.0/sites/hello/permissions/read/microsoft.graph.grant

The "microsoft.graph.grant" part is not part of the API unless I'm missing something: https://docs.microsoft.com/en-us/graph/api/site-post-permissions?view=graph-rest-1.0&tabs=http

Workaround

New-MgSitePermission works as expected

JustinGrote avatar May 02 '22 21:05 JustinGrote

Thanks for bringing this to our attention.

According to the service metadata (our single source of truth), grant-mgsitepermission command is valid as it calls grant action that's bound to permission:

<Action Name="grant" IsBound="true">
  <Parameter Name="bindingParameter" Type="graph.permission" />
  <Parameter Name="roles" Type="Collection(Edm.String)" Unicode="false" />
  <Parameter Name="recipients" Type="Collection(graph.driveRecipient)" />
  <ReturnType Type="Collection(graph.permission)" />
</Action>

I'll reach out to the workload owner to understand if this is intentional or not.

peombwa avatar May 12 '22 23:05 peombwa

Any update on this? Been a little while.

joshtransient avatar Dec 13 '22 14:12 joshtransient

@joshtransient, still no response from the workload owner on this.

Is this a blocking issue? You should be able to perform all publicly documented operations on permissions using the module without any issue - https://learn.microsoft.com/en-us/graph/api/site-update-permission?view=graph-rest-1.0&tabs=powershell#request.

peombwa avatar Dec 13 '22 17:12 peombwa

It is not a blocker for me. I've been using New-MgSitePermission and Update-MgSitePermission without issue. I try to keep an eye on the SharePoint-specific issues this module has so I know how best to direct my customers.

joshtransient avatar Dec 13 '22 17:12 joshtransient

Got it! We just had an internal discussion on the issue. The API path/command is invalid and will be removed from the service CSDL metadata via a new annotation. The work to add the new annotation is still ongoing.

I've transferred the issue to the metadata repro under https://github.com/microsoftgraph/msgraph-metadata/issues/169#issuecomment-1349773447 for tracking.

peombwa avatar Dec 13 '22 21:12 peombwa