Share via

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 Security | Microsoft Graph
0 comments No comments

1 answer

Sort by: Most helpful
  1. CarlZhao-MSFT 46,456 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.

    Was this answer helpful?


Your answer

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