本文介绍了如何从Sharepoint资产库获取文件名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从SharePoint 2013资产库中获取图像的文件名?

How can I get the file name of an image from a SharePoint 2013 Asset Library?

我正在尝试编写一个JQuery/REST代码段,以基于其他列值搜索库中的图像子集并显示它们.如果使用的是文档库,我会使用FileLeafRef,但是在资产库中找不到等效字段.

I am trying to write a JQuery/REST snippet to search a subset of images within the library, based on their other column values and display them. I would use FileLeafRef in case of a Document Library, but I couldn't find an equivalent field in Asset Library.

到目前为止,我尝试了以下操作,均未返回文件名:https:///crm/_api/Web/Lists/GetByTitle('Publication%20List')/items?select =文件/名称和扩展=文件https:///crm/_api/Web/Lists/GetByTitle('Publication%20List')/items?select = FileLeafRef

I so far tried the following, neither returns file name:https:///crm/_api/Web/Lists/GetByTitle('Publication%20List')/items?select=File/Name&expand=Filehttps:///crm/_api/Web/Lists/GetByTitle('Publication%20List')/items?select=FileLeafRef

推荐答案

在您的示例中有一个 typo ,特别是$符号对于 missing >和$expand查询选项(更多详细信息) .

There is a typo in your example, in particular $ symbol is missing for $select and $expand query options (more details).

以下其余端点演示了如何从Assets库中检索文件名:

The following rest endpoints demonstrate how to retrieve file name from Assets library:

1)使用FileLeafRef属性:

/_api/web/lists/getByTitle('<list title>')/items?$select=FileLeafRef

2)使用File/Name属性:

/_api/web/lists/getbytitle('<list title>')/items?$select=File/Name&$expand=File

3)使用Folder/Files属性:

/_api/web/getfolderbyserverrelativeurl('<list url>')/files?$select=Name

这篇关于如何从Sharepoint资产库获取文件名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 13:37