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

クライアント アプリケーションがリストを表示するかどうかの決定に使用できるフラグを指定する値を取得または設定します。

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

var object = new SP.NavigationNode()

メンバー

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

Constructor

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

コンストラクター

説明

NavigationNode

Initializes a new instance of the SP.NavigationNode object.

メソッド

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

メソッド

説明

deleteObject

Deletes the navigation node.

initPropertiesFromJson

更新プログラム

Updates property changes that have been made to the navigation node.

プロパティ

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

プロパティ

説明

Gets the collection of child nodes of the navigation node.

id

Gets a value that specifies the identifier for the navigation node.

isDocLib

isExternal

isVisible

タイトル

Gets or sets value that specifies the anchor text for the navigation node link.

url

Gets or sets a value that specifies the URL stored with the navigation node.

次の例では、ノードを現在の Web サイトのサイド リンク バーの領域に追加し、サイド リンク バーの現在のノードを表示するアプリケーション ページの [入力] ボタンを作成します。

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

    var quickLaunchNodeCollection = null;
    var nnci = null;
    function runCode() {

        var clientContext = new SP.ClientContext.get_current();

        if (clientContext != undefined && clientContext != null) {
            var web = clientContext.get_web();

            // Get the Quick Launch navigation node collection.
            this.quickLaunchNodeCollection = web.get_navigation().get_quickLaunch();

            // Set properties for a new navigation node.
            this.nnci = new SP.NavigationNodeCreationInformation();
            nnci.set_title('MyNode');
            nnci.set_url('https://localhost');
            // Create node as the last node in the collection.
            nnci.set_asLastNode(true);
            this.quickLaunchNodeCollection.add(nnci);

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

    function onQuerySucceeded() {
        var nodeInfo = '';
        var nodeEnumerator = this.quickLaunchNodeCollection.getEnumerator();
        while (nodeEnumerator.moveNext()) {
            var node = nodeEnumerator.get_current();
            nodeInfo += node.get_title() + '\n';
        }
        alert("Current nodes: \n\n" + nodeInfo);
    }

    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>