英文:
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
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
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
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
any idea?
答案1
得分: 3
你可以将你的图形包降级到 v4.x 版本。
这是因为在 V5.x SDK 中,QueryOption 类不再使用。
> 要传递查询选项,不再使用 QueryOption 类。可以使用 requestConfiguration 修饰符来设置查询选项,如下所示:
var user = await graphServiceClient
.Users["{user-id}"]
.GetAsync(requestConfiguration => requestConfiguration.QueryParameters.Select = new string[] { "id", "createdDateTime" });
英文:
you might downgrade your graph package to v4.x.
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"});
答案2
得分: 2
在SDK v5中有一些重大变更,QueryOption
类不再存在。
在v4中,所有请求构建器只有一个 QueryOption
类,但在SDK v5中,针对每个端点和请求类型,如 MessagesRequestBuilderGetQueryParameters
、ApplicationsRequestBuilderGetQueryParameters
等,都有一个特定的 <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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论