图 api 在写入 mp4 文件时抛出 BadRequest
The graph api is throwing BadRequest while writing mp4 file
我正尝试在 onedrive 上逐块写入视频文件,但是图表 api 向我抛出 BadRequest。
谁能帮帮我...
我正在使用此代码写入文件,除了视频文件我可以在 onedrive 上创建和写入文件。
graphClient.Users[UserEmailID].Drive.Items[Item.ParentItemID].Children.Request().AddAsync(SourceDriveItem).Result;
以下是 SourceDriveItem
的 Json
{
"file": {
"hashes": {
"quickXorHash": "bxXAIfX9S1d5xN8dqthmIc0m5L8=",
"@odata.type": "microsoft.graph.hashes"
},
"mimeType": "video/mp4",
"@odata.type": "microsoft.graph.file"
},
"fileSystemInfo": {
"createdDateTime": "2021-08-20T07:38:52+00:00",
"lastModifiedDateTime": "2021-08-20T07:38:52+00:00",
"@odata.type": "microsoft.graph.fileSystemInfo"
},
"photo": {
"takenDateTime": "2015-08-07T09:13:02+00:00",
"@odata.type": "microsoft.graph.photo"
},
"size": 1570024,
"video": {
"audioBitsPerSample": 110288,
"audioChannels": 2,
"audioFormat": "{00001610-0000-0010-8000-00AA00389B71}",
"audioSamplesPerSecond": 48000,
"bitrate": 291808,
"duration": 30526,
"fourCC": "H264",
"frameRate": 30000.0,
"height": 270,
"width": 480,
"@odata.type": "microsoft.graph.video"
},
"createdDateTime": "2021-08-20T07:38:52+00:00",
"lastModifiedBy": {
"user": {
"displayName": "SysTools Dev2",
"id": "38a682a6-5390-4e43-8610-442f35cb0026",
"@odata.type": "microsoft.graph.identity",
"email": "admin@dev2systoolsgroup.onmicrosoft.com"
},
"@odata.type": "microsoft.graph.identitySet"
},
"lastModifiedDateTime": "2021-08-20T07:38:52+00:00",
"name": "file_example_MP4_480_1_5MG.mp4",
"@odata.type": "microsoft.graph.driveItem"
}
我只是将请求正文中的视频 属性 设置为 null,问题就解决了。所以避免在添加文件时在 DriveItem 中设置 Video 对象
我正尝试在 onedrive 上逐块写入视频文件,但是图表 api 向我抛出 BadRequest。
谁能帮帮我...
我正在使用此代码写入文件,除了视频文件我可以在 onedrive 上创建和写入文件。
graphClient.Users[UserEmailID].Drive.Items[Item.ParentItemID].Children.Request().AddAsync(SourceDriveItem).Result;
以下是 SourceDriveItem
的 Json {
"file": {
"hashes": {
"quickXorHash": "bxXAIfX9S1d5xN8dqthmIc0m5L8=",
"@odata.type": "microsoft.graph.hashes"
},
"mimeType": "video/mp4",
"@odata.type": "microsoft.graph.file"
},
"fileSystemInfo": {
"createdDateTime": "2021-08-20T07:38:52+00:00",
"lastModifiedDateTime": "2021-08-20T07:38:52+00:00",
"@odata.type": "microsoft.graph.fileSystemInfo"
},
"photo": {
"takenDateTime": "2015-08-07T09:13:02+00:00",
"@odata.type": "microsoft.graph.photo"
},
"size": 1570024,
"video": {
"audioBitsPerSample": 110288,
"audioChannels": 2,
"audioFormat": "{00001610-0000-0010-8000-00AA00389B71}",
"audioSamplesPerSecond": 48000,
"bitrate": 291808,
"duration": 30526,
"fourCC": "H264",
"frameRate": 30000.0,
"height": 270,
"width": 480,
"@odata.type": "microsoft.graph.video"
},
"createdDateTime": "2021-08-20T07:38:52+00:00",
"lastModifiedBy": {
"user": {
"displayName": "SysTools Dev2",
"id": "38a682a6-5390-4e43-8610-442f35cb0026",
"@odata.type": "microsoft.graph.identity",
"email": "admin@dev2systoolsgroup.onmicrosoft.com"
},
"@odata.type": "microsoft.graph.identitySet"
},
"lastModifiedDateTime": "2021-08-20T07:38:52+00:00",
"name": "file_example_MP4_480_1_5MG.mp4",
"@odata.type": "microsoft.graph.driveItem"
}
我只是将请求正文中的视频 属性 设置为 null,问题就解决了。所以避免在添加文件时在 DriveItem 中设置 Video 对象