问题描述
0
收藏
我不敢相信这太难了。这就是我需要的东西,我似乎只是在追逐我的尾巴,而不是在任何地方。
I can't believe this is so difficult. Here is what I need and I just seem to be chasing my tail and not getting anywhere.
- 在我的本地数据库中,我存储了路径和文件ID SharePoint中的文件以及其他一些元数据。
- 拉取路径和文件ID,我可以使用_api / web / lists / getbyTitle('')/ items()来查找此文件对象。我可以在Postman中看到返回结果。
这很好。
第二个1.我可以在SharePoint中搜索文件使用_api / search / query?queryText =''这将返回一个搜索结果列表,其中包含我需要向用户显示的数据。即,Path,ServerRedirectedURL,ServerRedirectedEmbedURL和ServerRedirectedPreviewURL。
Second 1. I can search for a file in SharePoint using the _api/search/query?queryText='' This return a list of search results with data that I need to diplay to the user. Namely, the Path, ServerRedirectedURL, ServerRedirectedEmbedURL, and ServerRedirectedPreviewURL.
根据其他优秀人员的建议,我将/?$ expand = file放到第一次搜索结束但仍然没有查看该文件的这些属性。所以:
Upon suggestions from other great folks here, I put /?$expand=file to the end of the first search but still do not see these attributes for the file. So:
- 有没有办法使用_api / web / lists / getbyTitle / item api调用来提取这些属性?如果没有,那么:
- 我可以从文件对象中提取属性并在搜索对象中使用它吗?例如,"GUID"指的是"GUID"。领域?
如果需要完成,我甚至会拨打两次API,我简直无法相信没有办法通过API使用ID或GUID进行搜索以撤回文件,或获取
搜索返回的文件的完整属性数据。
I would even make two calls to the API if needed to get this done, I just can't believe that there isn't a way to do a search with an ID or GUID through the API to pull back a file, or a way to get the full attribute data of a file that is returned by the search.
对此目的的任何帮助都会非常感激。
Any help to this end would be much, much appreciated.
谢谢。
推荐答案
您可以使用内容搜索Web部件显示托管属性和搜索结果:
You could display the managed properties and search results with Content Search Web part:
For示例搜索特定库中的文件,直接设置搜索路径:
For example search files in a specific library, directly setting the path to search:
然后在Web部件中,更改要显示的托管属性的地图:
Then in the web part, change the map of managed properties which you want to show:
关于在Rest中执行操作的问题,它应该使用Search Rest API使用querytext,ServerRedirectedURL,ServerRedirectedPreviewURL,ServerRedirectedEmbedURL是托管属性,而不是普通列表
Rest API中存在的普通文件属性。
And for the concern about doing in Rest, it should be using the Search Rest API with querytext, as the ServerRedirectedURL, ServerRedirectedPreviewURL,ServerRedirectedEmbedURL is the managed properties, not the normal file properties existed in Normal list Rest API.
谢谢
最好的问候
这篇关于获取文件属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!