SP へListDataSource オブジェクト (sp.js)

ファイルに対応するリスト アイテムのリスト アイテム フィールド (2) 値を指定します。

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

var object = new SP.ListDataSource()

メンバー

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

Constructor

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

コンストラクター

説明

ListDataSource

Initializes a new instance of the SP.ListDataSource object.

メソッド

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

メソッド

説明

initPropertiesFromJson

writeToXml

プロパティ

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

プロパティ

説明

プロパティ

Gets the properties associated with the connection to the data source.

typeId

このメンバーは内部使用のために予約済みです。ユーザーのコードから直接使用されるものではありません。

次の例は、現在の Web サイトのリストが表示されているアプリケーション ページの [入力] ボタンを作成します。

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

function runCode() {
    var clientContext = new SP.ClientContext(); 
    site = clientContext.get_web();
    clientContext.load(site);

    listCollection = site.get_lists();
    clientContext.load(listCollection, 'Include(Title,DataSource)');
    clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
}

function onQuerySucceeded() {
    var ds;
    var targetList;
    var messageExternal = "External Lists:";
    var messageNormal = "Normal Lists:";
    var listEnumerator = listCollection.getEnumerator();
    while (listEnumerator.moveNext()) {
        targetList = listEnumerator.get_current();
        // Get a ListDataSource object.
        ds = targetList.get_dataSource();
        if (!SP.ScriptUtility.isNullOrUndefined(ds)) {
            messageExternal += '\n\t' + targetList.get_title();
            // Get connection properties of the ListDataSource object.
            messageExternal += '(Entity=' + ds.get_properties()["Entity"] + ';  ';
            messageExternal += 'LOB System=' + ds.get_properties()["LobSystemInstance"] + ');  ';
        }
        else {
            messageNormal += "\n\t" + targetList.get_title();
        }
    }
    alert(messageExternal + "\n\n" + messageNormal);
}

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

</script>

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

</asp:Content>