SP へフォルダーのオブジェクト (sp.js)

SharePoint Web サイト上のフォルダを表します。

**適用対象:**apps for SharePoint | SharePoint Foundation 2013 | SharePoint Server 2013

この記事の内容
メンバー
注釈
他のリソースのエンドポイント

var object = new SP.Folder()

メンバー

Folderオブジェクトでは、次のメンバーがあります。

Constructor

Folderオブジェクトでは、次のコンスがあります。

コンストラクター

説明

フォルダー

Initializes a new instance of the SP.Folder object.

メソッド

Folderオブジェクトでは、次の方法があります。

メソッド

説明

deleteObject

Deletes the list folder.

削除済みデータします。

Moves the list folder to the Recycle Bin and returns the identifier of the new Recycle Bin item.

更新プログラム

Updates the list folder with changes that have been made to the list folder properties.

プロパティ

Folderオブジェクトでは、次のプロパティがあります。

プロパティ

説明

contentTypeOrder

Specifies the sequence in which content types are displayed.

ファイル

Gets the collection of all files contained in the list folder.

フォルダー

Gets the collection of list folders contained in the list folder.

itemCount

Gets a value that specifies the count of items in the list folder.

listItemAllFields

Specifies the list item field (2) values for the list item corresponding to the file.

Gets the name of the folder.

parentFolder

Gets the parent list folder of the folder.

プロパティ

Gets the collection of all files contained in the folder.

serverRelativeUrl

Gets the server-relative URL of the list folder.

uniqueContentTypeOrder

Gets or sets a value that specifies the content type order.

welcomePage

Gets or sets a value that specifies folder-relative URL for the list folder welcome page.

注釈

既定のスカラー プロパティの種類を設定するのには、 UniqueContentTypeOrderプロパティが含まれていません。

次の例では、現在の Web サイト上のフォルダーの一覧を示すアプリケーション ページの [入力] ボタンを作成します。

<asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">
<script type="text/ecmascript" language="ecmascript">

    var folderCollection;
    function runCode() {

        var clientContext = new SP.ClientContext.get_current();
        if (clientContext != undefined && clientContext != null) {
            this.web = clientContext.get_web();

            this.folderCollection = web.get_folders();

            clientContext.load(this.folderCollection);

            clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
        }
    }

    function onQuerySucceeded(sender, args) {
        var folderInfo = 'The current site contains the following folders:\n\n';
        var folderEnumerator = this.folderCollection.getEnumerator();
        while (folderEnumerator.moveNext()) {
            var folderItem = folderEnumerator.get_current();
            folderInfo += folderItem.get_name() + '\n';
        }
        alert(folderInfo);
    }

    function onQueryFailed(sender, args) {
        alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
    }

</script>

    <input id="Button1" type="button" value="Run Code" onclick="runCode()" />

</asp:Content>

他のリソースのエンドポイント

詳細については、フォルダーのリソースを参照してください。

エンドポイント URI 構造

http://<sitecollection>/<site>/_api/web/folders/getbyurl(folderrelativeurl)

HTTP 要求

このリソースには、次の HTTP コマンドがサポートしています。

書式を削除します。

DELETE http://<sitecollection>/<site>/_api/web/folders/getbyurl(folderrelativeurl)

書式を結合します。

MERGE http://<sitecollection>/<site>/_api/web/folders/getbyurl(folderrelativeurl)

投稿の書式

POST http://<sitecollection>/<site>/_api/web/folders/getbyurl(folderrelativeurl)

書式を配置します。

PUT http://<sitecollection>/<site>/_api/web/folders/getbyurl(folderrelativeurl)