microsoftgraph / msgraph-sdk-go

Microsoft Graph SDK for Go
https://docs.microsoft.com/en-us/graph/sdks/sdks-overview
MIT License
214 stars 32 forks source link

Can't set SkuID to add a license to a user #735

Closed Trevor-J-Ortiz closed 1 day ago

Trevor-J-Ortiz commented 2 weeks ago

On the assign license doc, it requires setting the SkuID using the uuid package. UUID is internal so it can't be imported. Is there another way to set the SkuID or am I doing this incorrectly?

https://github.com/microsoftgraph/msgraph-sdk-go/blob/v1.45.0/models/assigned_license.go https://learn.microsoft.com/en-us/graph/api/user-assignlicense?view=graph-rest-1.0&tabs=go image

andrueastman commented 1 week ago

Thanks for raising this @Trevor-J-Ortiz

Any chance you can confirm if the GO sample at the link below is helpful? https://learn.microsoft.com/en-us/graph/api/user-assignlicense?view=graph-rest-1.0&tabs=go

Trevor-J-Ortiz commented 1 week ago

@andrueastman I did review this and that's where I ran into the issue. It shows the following code that leverages uuid.UUID which is an internal package. This is preventing me from using uuid.MustParse(), even if I got around the uuid by copying the uuid package code, .SetSkuId requires a *uuid.UUID parameter (as I screenshotted above). Below is a copy of the code I'm having issue with from the learn docs.

skuId := uuid.MustParse("45715bb8-13f9-4bf6-927f-ef96c102d394") assignedLicense.SetSkuId(&skuId)

addLicenses := []graphmodels.AssignedLicenseable { assignedLicense, }

andrueastman commented 1 week ago

@Trevor-J-Ortiz

I believe you only need to add the import for "github.com/google/uuid" as the generated code relies on the package for the type.

Any chance you can confirm this works out for you?

microsoft-github-policy-service[bot] commented 5 days ago

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.