Missing memberOf user property after MS Graph OData source inferring

I try to get the groups of a user, by calling the MS Graph API (following the example from the docs).


For the "me" entity, there seems to be a memberOf attribute:

But after saving the data source (which generates a bunch of classes), "memberOf" doesn't show up, when creating a invoke method on getMe:


To verify the connection in general, I was able to show all groups in the directory by calling the data source method getGroups.

And the user is in a group. Side note: this project only contains the MS Graph example. It does not contain an extra security part, with authentication:

Thanks for any hints, where I am going wrong here.

Hi @rene,

Looks like there is a bug in the entities three - me is a singleton (returns User) and it's listed in Singletons section:


1 Like

Thank you for your reply. I guess creating the OData interface for Microsoft Graph was a bit an overkill for a productive system to just get the security groups. I will go over to use the MS Graph SDK now.

But out of curiosity and because you mentioned it could be a bug, I started to look closer at the meta data in MSGraph.json. I leave you the findings with the hope it could be useful for you or others.

First, my assumption was wrong, that memberOf should appear in the property list in the screenshot above. Because memberOf is not a property of the User object, but a method (see OData specification of MS Graph for User).
Second, as a method, according to my understanding it should appear in the path-section within MSGraph.json, the meta data of the interface and show up in the invoke data source methods afterwards.

Adding the JSON section at the end of this post, into the "path" attribute in MSGRaph.json, I was able to make the method appear in the UI:
image
But I was not able to get rid of the errors for the returned type. I tried "microsoft.graph.directoryObject" or "microsoft.graph.group" and got this error for the later:

dotnet: C:\git\examples\MSGraphDemo\server\Pages\TestMsGraph.razor(43,114): error CS1503: Argument 1: cannot convert from 'Radzen.ODataServiceResult<Microsoft.Graph.Group>' to 'System.Collections.Generic.IEnumerable<Microsoft.Graph.DirectoryObject>' [C:\git\examples\MSGraphDemo\server\MsGraphDemo.csproj]

This was my custom method for the JSON interface specification:

  "/users('{id}')/memberOf": {
      "get": {
        "operationId": "getUsersMemberOf",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "type": "string"
          },
          {
            "name": "$top",
            "type": "integer",
            "required": false,
            "in": "query"
          },
          {
            "name": "$orderby",
            "type": "string",
            "required": false,
            "in": "query"
          },
          {
            "name": "$select",
            "type": "string",
            "required": false,
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "List of groups",
            "schema": {
              "type": "object",
              "properties": {
                "value": {
                  "type": "array",
                  "items": {
                    "$ref": "#/definitions/microsoft.graph.group"
                  }
                }
              }
            }
          },
          "default": {
            "description": "Unexpected error",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          }
        }
      }
    },

Thanks! We will do our best fix this in one of our next updates!