为了账号安全,请及时绑定邮箱和手机立即绑定

在上传的文件中包含说明

在上传的文件中包含说明

PHP
潇湘沐 2024-01-20 21:12:47
我正在使用 Graph API,使用Graph API中的示例代码我可以将文件上传到OneDrive.GraphServiceClient graphClient = new GraphServiceClient(authProvider);var stream = "The contents of the file goes here."await graphClient.Me.Drive.Items["{item-id}"]    .Request()    .PutAsync(stream);问题是,我想包含Description到上传的文件中。我不知道这是否可能,但找不到相关信息。
查看完整描述

1 回答

?
天涯尽头无女友

TA贡献1831条经验 获得超9个赞

这取决于是否使用OneDrive personalOneDrive for Business/SharePoint document library 驱动器类型。

driveItem资源类型页面

description String提供用户可见的项目描述。读写。仅适用于 OneDrive 个人版

对于 OneDrive Personal,driveItem.Description属性可以这样更新:

//upload a file

var driveItem = await graphClient.Me.Drive.Items[itemId]

    .Content

    .Request()

    .PutAsync<DriveItem>(stream);



//update driveItem

var updateItem = new DriveItem { Description = "File uploaded" };

await graphClient.Me.Drive.Items[driveItem.Id].Request().UpdateAsync(updateItem);


查看完整回答
反对 回复 2024-01-20
  • 1 回答
  • 0 关注
  • 24 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信