Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/powerbi/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 需要为C中一个驱动器上载的_graphServiceClient添加参考#_C#_Microsoft Graph Api - Fatal编程技术网

C# 需要为C中一个驱动器上载的_graphServiceClient添加参考#

C# 需要为C中一个驱动器上载的_graphServiceClient添加参考#,c#,microsoft-graph-api,C#,Microsoft Graph Api,在我们使用VisualStudioMVC的项目中,我对pdf有一个要求。我已经在azure客户端active directory支持下使用httprequest完成了这项工作。很好,但是我们可以上传到4MB 为了检查超过4MB的文件上传,我尝试了可恢复的文件上传代码,它使用包Microsoft.Graph。我是从nuget软件包安装的。大多数网站都解释了代码,但我不知道如何创建object\u graphServiceClient。我需要包含这个_graphServiceClient对象的引用是

在我们使用VisualStudioMVC的项目中,我对pdf有一个要求。我已经在azure客户端active directory支持下使用httprequest完成了这项工作。很好,但是我们可以上传到4MB

为了检查超过4MB的文件上传,我尝试了可恢复的文件上传代码,它使用包Microsoft.Graph。我是从nuget软件包安装的。大多数网站都解释了代码,但我不知道如何创建object\u graphServiceClient。我需要包含这个_graphServiceClient对象的引用是什么

我发现但不确定GraphServiceClient是否是类。因此,我在项目中包含以下代码:

GraphServiceClient _graphServiceClient = new GraphServiceClient(authProvider); 
有谁能帮助我理解,如何在解决方案中正确地包括_graphServiceClient?为了使其正常工作,引用或任何内容是什么

var uploadSession = await _graphServiceClient.Drives[driveId].Items[folderId].ItemWithPath(fileName).CreateUploadSession().Request().PostAsync();

int maxSlice = 320 * 1024;

var largeFileUpload = new LargeFileUploadTask<DriveItem>(uploadSession, fileStream, maxSlice);

IProgress<long> progress = new Progress<long>(x =>
{
    _logger.LogDebug($"Uploading large file: {x} bytes of {fileStream.Length} bytes already uploaded.");
});

UploadResult<DriveItem> uploadResult = await largeFileUpload.UploadAsync(progress);

resultDriveItem = uploadResult.ItemResponse;
var uploadSession=await\u graphServiceClient.Drives[driveId].Items[folderId].ItemWithPath(fileName).CreateUploadSession().Request().PostAsync();
int maxSlice=320*1024;
var largeFileUpload=新的LargeFileUploadTask(uploadSession、fileStream、maxSlice);
i进度=新进度(x=>
{
_logger.LogDebug($“上载大文件:{fileStream.Length}字节中的{x}字节已上载。”);
});
UploadResult UploadResult=等待largeFileUpload.UploadAsync(进度);
resultDriveItem=uploadResult.ItemResponse;

如果您使用的是Microsoft Graph.NET SDK(NuGet软件包),请尝试以下参考:

安装软件包Microsoft.Graph

安装软件包Microsoft.Graph.Auth-IncludePrecision

下面是所有可用SDK的示例