Home  >  Article  >  Backend Development  >  msgraph-sdk-go cannot create more than two extensions for one user

msgraph-sdk-go cannot create more than two extensions for one user

王林
王林forward
2024-02-09 10:39:31611browse

msgraph-sdk-go 无法为一个用户创建两个以上的扩展

php editor Xinyi discovered that there are limitations when using msgraph-sdk-go to create extensions for one user, that is, it is impossible to create more than two extensions for one user. This limitation may cause inconvenience to some specific requirements and requires developers to pay attention during design and implementation. However, despite this limitation, msgraph-sdk-go is still a powerful and easy-to-use tool that can help developers quickly build and manage Microsoft Graph API-related applications. Whether you are creating extensions or other functions, msgraph-sdk-go is a recommended choice.

Question content

When I try to create a schema extension for a user like this

schemaextension := graphmodels.newschemaextension()
additionaldata := map[string]interface{}{
    "extensionname": "dean.ext.test.1",
    "theme":         "dark",
    "color":         "purple",
    "lang":          "english",
}
schemaextension.setadditionaldata(additionaldata)

if result, err := client.usersbyid(userid).extensions().post(context.background(), schemaextension, nil); err != nil {

I get this error:

Error: error status code received from the API
    code: BadRequest
    msg: Maximum number of extensions values supported per application is 2.

But I haven't created any schema extension for this user yet. I've created two open extensions, but I should be able to create other schema extensions.

Why does the error message show that the extension is per-app? The code above attempts to create the extension on a specific user rather than the application.

I want to remove the user's extensions, but I can't find anything in the portal that shows the user's extensions. Where can I find a user's extensions in the portal?

The portal does show user attributes that appear to apply to all users. Are user properties related to extensions? How can I access these user properties using msgraph-sdk-go?

Workaround

msgraph-sdk-go is currently at version 0.55 and is a non-production preview. After discussions with some colleagues, we decided to ditch the MS Graph SDK and use the v 1.0 Graph REST endpoints directly. They were successful with this approach, but found that the SDK wasn't much help.

The above is the detailed content of msgraph-sdk-go cannot create more than two extensions for one user. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:stackoverflow.com. If there is any infringement, please contact admin@php.cn delete