从 assetLibrary 视频中获取文件名、描述、ID 和扩展名

fetch file name, description, id and extension from assetLibrary videos

let rootUrl = 'https://example.sharepoint.com/'
$.ajax({
  url: `${rootUrl}_api/web/lists/getByTitle('videos')/items?$select=Id,Title,VideoSetDescription&$filter=ContentType eq 'Video'`,
   type: 'GET',
headers: {
  accept: 'application/json;odata=verbose'
},
success: res => console.log(res.d.results),
error: err => console.log(JSON.stringify(err))
})

我得到的文件名是 example.,我怎样才能得到带扩展名的文件名 像 example.mp4 我还需要获取 ID、标题和 VideoSetDescription。

在您的情况下,查询 returns 对应于所谓的 视频集 的项目列表(按 Video 内容类型过滤)。这又代表 实际存储一个或多个文件的容器 。有关详细信息,请参阅 Video Experience in SharePoint 2013 资产库中的视频组织方式。

话虽如此,您可以将 &$expand=Folder/Files 表达式附加到您的查询中,它告诉 return 上传的文件以及 items.Then 文件名可以像这样打印:

success: response => {
   response.d.results.forEach( item => {
      console.log(item.Folder.Files.results[0].Name); //print first uploaded file
   });
},  

要仅检索与上传文件关联的项目列表,可以使用以下查询:

/_api/web/lists/getByTitle('<Assets Library>')/items?$select=FileLeafRef&$filter=ContentType eq 'Video Rendition'