首页 > 解决方案 > Microsoft.Graph.Beta.dll 缺少 IPrintDocumentRequestBuilder.Content() 尽管 MS Graph Explorer 代码片段提示它?

问题描述

MS Graph Explorer显示您输入的 HTTP 请求的 C# 代码片段(这是一个可爱的功能)。

我输入的 http 请求是(我用 {ID} 替换了我的 GUID): https://graph.microsoft.com/beta/print/printers/{printerID}/jobs/{jobID}/documents/{documentID} /$值

这是使用 Beta/Preview 中的“通用打印”API。

MS Graph Explorer 显示的代码片段是:

GraphServiceClient graphClient = new GraphServiceClient( authProvider );

var stream = await graphClient.Print.Printers["{printerID}"].Jobs["{jobID}"].Documents["{documentID}"].Content
    .Request()
    .GetAsync();

但是......当我将此代码粘贴到我的 C# VS2019 .NET Core 3.1 代码中时,它抱怨说:

'IPrintDocumentRequestBuilder' does not contain a definition for 'Content' and no accessible extension method 'Content' accepting a first argument of type 'IPrintDocumentRequestBuilder' could be found (are you missing a using directive or an assembly reference?)

这是一个惊喜,更糟糕的是,当我通过 dotPeek 查看 Microsoft.Graph.Beta.dll (0.32.0-preview) 时,错误似乎是正确的,没有 IPrintDocumentRequestBuilder 的 Content 方法。

有谁知道为什么 MS Graph Explorer 中的代码片段建议使用 Microsoft.Graph.Beta.dll 中不存在的 C# 方法?或者更好的是我需要做些什么才能让它工作?

我的目标是通过 MS Graph Explorer 下载打印作业文档的内容。X

标签: c#microsoft-graph-api.net-core-3.1

解决方案


IPrintDocumentRequestBuilder.Content() 现在出现在 DLL 中。对我有用的版本是 v0.38.0-preview https://www.nuget.org/packages/Microsoft.Graph.Beta/0.38.0-preview/


推荐阅读