0

I am new to microsoft graph api and trying to use "List Places" api using graphClient. Unable to find any places method for graphClient as shown in microsoft document below:

https://learn.microsoft.com/en-us/graph/api/place-list?view=graph-rest-1.0&tabs=java

IGraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();

IRoomCollectionPage microsoft.graph.room = graphClient.places().microsoft.graph.room()
    .buildRequest()
    .get();

Here is my code(cannot see places() method for graphClient object created):

AuthProvider authProvider = new AuthProvider(getTokenUsingGraphClientSecret());
            graphClient = GraphServiceClient.builder().authenticationProvider(authProvider)
                    .buildClient();

token code:

IClientCredential credential = ClientCredentialFactory.createFromSecret(CLIENT_SECRET);
             ConfidentialClientApplication cca =
                     ConfidentialClientApplication
                             .builder(CLIENT_ID, credential)
                             .authority(AUTHORITY)
                             //.setTokenCacheAccessAspect(tokenCacheAspect)
                             .build();

IAuthenticationResult result = cca.acquireToken(parameters).join();

Also, not getting option to import IRoomCollectionPage class.

Note: I am using below dependency in my build.gradle:

    compile group: 'com.microsoft.graph', name: 'microsoft-graph', version: '1.7.1'
    // https://mvnrepository.com/artifact/com.microsoft.azure/msal4j
    compile group: 'com.microsoft.azure', name: 'msal4j', version: '1.5.0'

Please let me know if i am missing something here. Thanks in advance.

Croy
  • 241
  • 3
  • 14

5 Answers5

1

Thanks to hqho,

Even with this the places API result its not complete.

PlaceCollectionRequestBuilder builder =
                new PlaceCollectionRequestBuilder(
                GraphServiceClient.DEFAULT_GRAPH_ENDPOINT + "/places/microsoft.graph.room",
                mClient,
                null);
Xinux
  • 11
  • 1
  • 1
    As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Feb 14 '22 at 14:35
1

Working and testes solutions

   String url = graphClient.places()
            .getRequestUrlWithAdditionalSegment("microsoft.graph.room");

   PlaceCollectionPage page = new PlaceCollectionRequestBuilder(url, graphClient, null)
            .buildRequest()
            .get();
borino
  • 1,720
  • 1
  • 16
  • 24
0

I have discovered the same thing. I'm also very interested in this issue. Why have a documentation, about classes and method calls, and a library that does not contains those classes ?

0

The reason why you see this is two parts:

  1. We haven't generated the client in a while. Those APIs are missing from the client. We are working on this now.
  2. We generate the code examples. The code examples are ahead of the client.

Sorry for the confusion. I'll update this post when we get this published.

Michael Mainer
  • 3,387
  • 1
  • 13
  • 32
  • Thanks @Michael Mainer for your response. Is there any possibility to provide ETA on when new client will be published? – Croy Jun 10 '20 at 11:51
  • @Croy, I'd like to have the new client published next week. – Michael Mainer Jun 11 '20 at 17:16
  • Thanks @Michael Mainer , Really appreciate your effort. Also could you please look into https://stackoverflow.com/questions/62372426/understanding-microsoft-graph-getschedule-api-functionality – Croy Jun 14 '20 at 12:21
  • It has ben a year without an update. Document is still wrong. – ibrahim demir Mar 27 '21 at 14:06
  • @MichaelMainer any update on this?? I tried using SDK 2.0 and it shows places() method but after that "microsoft.graph.room()" is missing as shown in example. Could you please provide any update? – Croy Apr 19 '21 at 10:49
0

It worked for me

 var url = graphClient.Places.RequestUrl + "/microsoft.graph.room";
 var builder = new GraphServicePlacesCollectionRequestBuilder(url, graphClient);
 var resp = await builder.Request().GetAsync();
hqho
  • 604
  • 7
  • 9