構文
SharePoint.Files(url as text, optional options as nullable record) as table
バージョン情報
サブフォルダー内のファイルを含む、指定したSharePoint サイトで見つかったファイルごとに 1 行を含むテーブルurl返します。
SharePoint.Contentsとは異なり、この関数はフラット テーブルを返し、フォルダーの行は含まれません。 サイト URL にクエリ文字列またはフラグメントを含めることはできません。 各行には、 Content 列のファイルのバイナリ コンテンツと、 Name、 Extension、 Date accessed、 Date modified、 Date created、 Attributes、および Folder Path 列のファイル メタデータが含まれます。
Folder Path値は、ファイルを含むフォルダーの絶対 URL です。 options を指定して、次のオプションを制御できます:
ApiVersion: このサイトで使用する SharePoint API のバージョンを指定する数値 (14 または 15) またはテキスト "Auto"。 指定しない場合、API バージョン 14 が使用されます。 Auto を指定すると、可能な場合にサーバー バージョンが自動検出されます。検出されない場合は、既定の 14 がバージョンに使用されます。 SharePoint サイトに必要な最小バージョンは、英語以外で 15 です。
例 1
自動 API 選択を使用して、Contoso SharePoint サイト内のすべてのファイルの名前、ファイル拡張子、およびフォルダー URL を一覧表示します。
使用方法
let
Source = SharePoint.Files(
"https://contoso.sharepoint.com/sites/Contoso",
[ApiVersion = "Auto"]
),
SelectedColumns = Table.SelectColumns(
Source,
{"Name", "Extension", "Folder Path"}
)
in
SelectedColumns
アウトプット
A table containing the name, extension, and absolute folder URL for each file in the site and its subfolders.
例 2
Contoso SharePoint サイトから.xlsx拡張子を持つすべてのファイルを返します。 この例では、英語と英語以外の両方のSharePoint サイトで動作する API バージョン 15 を使用します。 拡張機能の比較では大文字と小文字が区別されないため、 .XLSXにも一致します。
使用方法
let
Source = SharePoint.Files(
"https://contoso.sharepoint.com/sites/Contoso",
[ApiVersion = 15]
),
ExcelWorkbooks = Table.SelectRows(
Source,
each Comparer.OrdinalIgnoreCase([Extension], ".xlsx") = 0
)
in
ExcelWorkbooks
アウトプット
A table containing every .xlsx file in the site and its subfolders.
例 3
Shared Documents/Reports フォルダーに直接格納されているファイルのみを返します。 完全一致 Folder Path は、サブフォルダー内のファイルを除外します。
使用方法
let
Source = SharePoint.Files("https://contoso.sharepoint.com/sites/Contoso"),
ReportsFiles = Table.SelectRows(
Source,
each [Folder Path] = "https://contoso.sharepoint.com/sites/Contoso/Shared Documents/Reports/"
)
in
ReportsFiles
アウトプット
A table containing only the files stored directly in the Reports folder.
例 4
共有ドキュメント/レポート フォルダーから Budget.xlsx のバイナリ コンテンツを返します。
使用方法
let
Source = SharePoint.Files("https://contoso.sharepoint.com/sites/Contoso"),
Budget = Source{
[
Name = "Budget.xlsx",
#"Folder Path" = "https://contoso.sharepoint.com/sites/Contoso/Shared Documents/Reports/"
]
}[Content]
in
Budget
アウトプット
The binary content of Budget.xlsx.