Microsoft.Graph.QueryOption 类型丢失

huangapple go评论63阅读模式
英文:

Microsoft.Graph.QueryOption type is missing

问题

I have .NET 6 console application and installed two Nuget packages

  • Azure.Identity (1.9)
  • Microsoft.Graph (5.12)

however following code does not work

Microsoft.Graph.QueryOption 类型丢失

the Microsoft.Graph.QueryOption type could not be found, but it should be available in the Microsoft.Graph package based on following documentation

https://learn.microsoft.com/en-us/dotnet/api/microsoft.graph.queryoption?view=graph-core-dotnet

Microsoft.Graph.QueryOption 类型丢失

any idea?

英文:

I have .NET 6 console application and installed two Nuget packages

  • Azure.Identity (1.9)
  • Microsoft.Graph (5.12)

however following code does not work

Microsoft.Graph.QueryOption 类型丢失

the Microsoft.Graph.QueryOption type could not be found, but it should be available in the Microsoft.Graph package based on following documentation

https://learn.microsoft.com/en-us/dotnet/api/microsoft.graph.queryoption?view=graph-core-dotnet

Microsoft.Graph.QueryOption 类型丢失

any idea?

答案1

得分: 3

你可以将你的图形包降级到 v4.x 版本。

Microsoft.Graph.QueryOption 类型丢失

这是因为在 V5.x SDK 中,QueryOption 类不再使用

> 要传递查询选项,不再使用 QueryOption 类。可以使用 requestConfiguration 修饰符来设置查询选项,如下所示:

var user = await graphServiceClient
    .Users["{user-id}"]
    .GetAsync(requestConfiguration => requestConfiguration.QueryParameters.Select = new string[] { "id", "createdDateTime" });

Microsoft.Graph.QueryOption 类型丢失

英文:

you might downgrade your graph package to v4.x.

Microsoft.Graph.QueryOption 类型丢失

That's because in V5.x SDK, QueryOption class is no longer used.

> To pass query Options, the QueryOption class is no longer used. Query
> options are set using the requestConfiguration modifier as follows

var user = await graphServiceClient
    .Users["{user-id}"]
    .GetAsync(requestConfiguration => requestConfiguration.QueryParameters.Select = new string[] { "id", "createdDateTime"});

Microsoft.Graph.QueryOption 类型丢失

答案2

得分: 2

在SDK v5中有一些重大变更QueryOption 类不再存在。

在v4中,所有请求构建器只有一个 QueryOption 类,但在SDK v5中,针对每个端点和请求类型,如 MessagesRequestBuilderGetQueryParametersApplicationsRequestBuilderGetQueryParameters 等,都有一个特定的 <xxx>QueryParameters 类。

您需要创建一些自定义的查询参数类。

英文:

There are breaking changes in SDK v5 and the QueryOption class is no longer there.

In v4 there was only one class QueryOption for all requests builders, but in SDK v5 there is a specific <xxx>QueryParameters class for each endpoint and request type like MessagesRequestBuilderGetQueryParameters, ApplicationsRequestBuilderGetQueryParameters etc.

You will need to create some custom class for query parameters.

huangapple
  • 本文由 发表于 2023年6月8日 20:36:51
  • 转载请务必保留本文链接:https://go.coder-hub.com/76431932.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定