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

の SP のコレクションを表しますRoleDefinitionの Web サイトを利用できる役割の定義を定義するオブジェクトを使用します。

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

var object = new SP.RoleDefinitionCollection()

メンバー

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

Constructor

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

コンストラクター

説明

RoleDefinitionCollection

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

メソッド

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

メソッド

説明

追加します。

Adds a new role definition to the collection based on the role definition information.

getById

Gets the role definition with the specified ID from the collection.

getByName

Gets the role definition with the specified name.

getByType

Gets the role definition with the specified role type.

itemAt

Gets the role definition at the specified index in the collection.

プロパティ

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

プロパティ

説明

childItemType

アイテム

Gets the role definition at the specified index in the collection.

次の例では、新しい役割を定義し、[役割の定義コレクションに追加するアプリケーション ページの [入力] ボタンを作成します。

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

    var roleDefinitionCollection;
    var roleDefinition;
    function runCode() {
        var clientContext = new SP.ClientContext.get_current();
        if (clientContext != undefined && clientContext != null) {
            var web = clientContext.get_web();

            var permissionsManage = new SP.BasePermissions();
            permissionsManage.set(SP.PermissionKind.manageUsers);

            // Specify properties of the role definition.
            var roleCreationInfo = new SP.RoleDefinitionCreationInformation();
            roleCreationInfo.set_basePermissions(permissionsManage);
            roleCreationInfo.set_description('Role for managing user permissions.');
            roleCreationInfo.set_name('Manage User');
            roleCreationInfo.set_order(1);

            // Add to the role definitions collection.
            this.roleDefinitionCollection = web.get_roleDefinitions();
            this.roleDefinition = this.roleDefinitionCollection.add(roleCreationInfo);

            clientContext.load(roleDefinition);

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

    function onQuerySucceeded() {
        alert('Created role: ' + this.roleDefinition.get_name());
    }

    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>

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

詳細については、 RoleDefinitionCollection リソースを参照してください。

エンドポイント URI 構造

http://<sitecollection>/<site>/_api/web/roledefinitions

HTTP 要求

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

書式を取得します。

GET http://<sitecollection>/<site>/_api/web/roledefinitions

投稿の書式

POST http://<sitecollection>/<site>/_api/web/roledefinitions