簡體   English   中英

SharePoint 2013 Library檢索所有文件名。 REST API

[英]SharePoint 2013 Library retrieving all file names. REST API

我在Sharepoint 2013上有一個庫,並使用以下代碼檢索所有參數(在客戶端使用angularjs。)。

var spListURL = siteURL + "_api/lists/getByTitle%28%27" + docLibName + "%27%29/items";
$http.get(spListURL,
{ headers: {"Accept": "application/json; odata=verbose", } }).success(function (result) {
    dfd.resolve(result);
})
.error(function (data, status, headers, config) {
    errorFactory.buildError(data, status, headers, ORIGIN_VIEW_NAME);
});

但是,結果不包含文件名或文件URL。 我需要創建一個指向該文件的錨鏈接。 它確實包含我添加到List / Lib的自定義參數。

我之前從未使用過SharePoint。 客戶端代碼是angularjs工廠的片段,它正在工作(就js而言是可以理解的)。

不想使用d.result[index].File.__deffered.uri 進行另一個休息調用,然后在一個新的空白窗口中打開文檔。

謝謝你的幫助。

試試吧

FileLeafRef

在你的網址中

site/_api/web/lists/getByTitle('LibraryName')/items?$top=1000&$select=FileLeafRef

如何使用SharePoint REST檢索文件名

選項1

通過FileLeafRef列表項屬性

REST端點:

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

選項2

通過File Name屬性:

REST端點:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM