gpt4 book ai didi

java - Microsoft Graph 放置 api 未在图形客户端中显示为方法

转载 作者:行者123 更新时间:2023-12-01 16:21:24 24 4
gpt4 key购买 nike

我是 Microsoft graph api 的新手,并尝试使用 graphClient 来使用“List Places”api。无法找到 graphClient 的任何地方方法,如下面的微软文档所示:

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();

这是我的代码(看不到创建的 graphClient 对象的 place() 方法):

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

token 代码:

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

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

此外,没有获得导入 IRoomCollectionPage 类的选项。

注意:我在 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'

如果我在这里遗漏了什么,请告诉我。提前致谢。

最佳答案

工作和睾丸解决方案

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

PlaceCollectionPage page = new PlaceCollectionRequestBuilder(url, graphClient, null)
.buildRequest()
.get();

关于java - Microsoft Graph 放置 api 未在图形客户端中显示为方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62264198/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com