SP へグループ オブジェクト (sp.js)
Microsoft SharePoint Foundation web サイトで、グループを表します。
**適用対象:**apps for SharePoint | SharePoint Foundation 2013 | SharePoint Server 2013
この記事の内容
メンバー
注釈
他のリソースのエンドポイント
var object = new SP.Group()
メンバー
Groupオブジェクトでは、次のメンバーがあります。
Constructor
Groupオブジェクトでは、次のコンスがあります。
コンストラクター |
説明 |
---|---|
Initializes a new instance of the SP.Group object. |
メソッド
Groupオブジェクトでは、次の方法があります。
メソッド |
説明 |
---|---|
Updates group properties after changes have been made. |
プロパティ
Groupオブジェクトでは、次のプロパティがあります。
プロパティ |
説明 |
---|---|
Gets or sets a value that indicates whether the group members can edit membership in the group. |
|
Gets or sets a value that indicates whether to allow users to request membership in the group and request to leave the group. |
|
Gets or sets a value that indicates whether the request to join or leave the group can be accepted automatically. |
|
Gets a value that indicates whether the current user can edit the membership of the group. |
|
Gets a value that indicates whether the current user can manage the group. |
|
Gets a value that indicates whether the current user can view the membership of the group. |
|
Gets or sets the description of the group. |
|
Gets or sets a value that indicates whether only group members are allowed to view the membership of the group. |
|
Gets or sets the owner of the group which can be a user or another group assigned permissions to control security. |
|
Gets the name for the owner of this group. |
|
Gets or sets the email address to which the requests of the membership are sent. |
|
Gets a collection of user objects that represents all of the users in the group. |
注釈
各グループは、ユーザーのコレクションが含まれているあり、一意の識別子があります。
例
次の例では、現在の web サイトの閲覧者グループに現在のユーザーを追加するアプリケーション ページのinputボタンを作成します。
<asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">
<script type="text/ecmascript" language="ecmascript">
var user;
var visitorsGroup;
function runCode() {
var clientContext = new SP.ClientContext();
var groupCollection = clientContext.get_web().get_siteGroups();
// Get the visitors group, assuming its ID is 4.
visitorsGroup = groupCollection.getById(4);
user = clientContext.get_web().get_currentUser();
var userCollection = visitorsGroup.get_users();
userCollection.addUser(user);
clientContext.load(user);
clientContext.load(visitorsGroup);
clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
}
function onQuerySucceeded() {
alert(user.get_title() + " added to group " + visitorsGroup.get_title());
}
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/sitegroups(groupid)
HTTP 要求
このリソースには、次の HTTP コマンドがサポートしています。
書式を結合します。
MERGE http://<sitecollection>/<site>/_api/web/sitegroups(groupid)
投稿の書式
POST http://<sitecollection>/<site>/_api/web/sitegroups(groupid)
書式を配置します。
PUT http://<sitecollection>/<site>/_api/web/sitegroups(groupid)