Getting error using roleEligibilitySchedules rest api

Amin, Sagar 0 Reputation points
2024-11-19T05:22:39.2166667+00:00

In my NodeJS app v18.17.1

I am using msgraph-sdk-javascript

      this._graphClient = Client.init({
        authProvider: (done) => {
          done(null, userToken);
        },
        defaultVersion: "beta",
        debugLogging: true
      });

Calling this end point

https://graph.microsoft.com/beta/roleManagement/directory/roleEligibilitySchedules?$select=principalId,roleDefinitionId,directoryScopeId,scheduleInfo,status&$filter=principalId eq 'ab73c20d-541d-58eb-7792-259b8cd50527'&$expand=roleDefinition

But I am getting this error

GraphError: {"ErrorCode":"CultureNotFoundException","Message":"Culture is not supported.\r\nParameter name: name\r\n* is an invalid culture identifier.","Target":null,"Details":null,"InnerError":null,"InstanceAnnotations":[],"TypeAnnotation":null}
  • And when i try same endpoint in Graph Explorer, it works.
  • I have tried two different machines to run this code

Has anyone luck in running this using Microsoft Graph JavaScript SDK?

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,480 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. CarlZhao-MSFT 43,016 Reputation points
    2024-11-19T08:30:45.9466667+00:00

    Hi @Amin, Sagar

    Try the following code snippet:

    const options = {
    	authProvider,
    };
    
    const client = Client.init(options);
    
    let roleEligibilitySchedules = await client.api('/roleManagement/directory/roleEligibilitySchedules')
    	.version('beta')
    	.filter('principalId eq \'xxxxxxxxxxxxxxxxxxxxx\'')
    	.expand('roleDefinition')
    	.select('principalId,roleDefinitionId,directoryScopeId,scheduleInfo,status')
    	.get();
    

    Hope this helps.

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


Your answer

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