Microsoft图形位置 API 不会在图形客户端中显示为方法



我是Microsoft graph api的新手,并尝试使用graphClient使用"List Places"api。 无法找到图形客户端的任何位置方法,如下面的微软文档所示:

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 对象的创建 places(( 方法(:

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

令牌代码:

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

感谢 hqho,

即使这样,地方 API 结果也不完整。

PlaceCollectionRequestBuilder builder =
new PlaceCollectionRequestBuilder(
GraphServiceClient.DEFAULT_GRAPH_ENDPOINT + "/places/microsoft.graph.room",
mClient,
null);

我也发现了同样的事情。我对这个问题也很感兴趣。 为什么有一个关于类和方法调用的文档,以及一个不包含这些类的库?

您看到此内容的原因是两部分:

  1. 我们有一段时间没有生成客户端了。客户端中缺少这些 API。我们现在正在研究这个问题。
  2. 我们生成代码示例。代码示例在客户端之前。

很抱歉造成混乱。当我们发布这篇文章时,我会更新这篇文章。

它对我有用

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

最新更新