Last active
March 23, 2017 04:51
-
-
Save SharePointX/d44ec6e268968fb9a1116bbbb8852258 to your computer and use it in GitHub Desktop.
SharePoint Client Object Model でサイトやサイトコレクションのモダンUIを無効化するコード ref: http://qiita.com/SharePoint_X/items/3a16dbb652fc10387df8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// モダンUI無効化サイト機能のIDを指定 | |
var featId4Web = "{52E14B6F-B1BB-4969-B89B-C4FAA56745EF}"; // SPListNextWebOptOut for Web | |
// コンテキスト取得 | |
var custCtx = new SP.ClientContext(); | |
// 対象の機能(Feature)を追加(Activate)予約 | |
var feat4Web = custCtx.get_web().get_features().add(new SP.Guid(featId4Web), true, SP.FeatureDefinitionScope.none); | |
// 機能(Feature) オブジェクト取得予約 | |
custCtx.load(feat4Web,'DisplayName'); | |
// サーバーへのクエリー実行(ここまでのコンテキストに含まれる指示予約を送信)custCtx.executeQueryAsync( | |
function() { // クエリー実行時コールバック処理 | |
// 追加した機能(Feature)の名前をコンソールに出力 | |
console.log(feat4Web.get_displayName() + " activated."); | |
}, | |
function(sender, args) { // クエリー失敗時コールバック処理 | |
console.error('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace()); | |
} | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// モダンUI無効化サイトコレクション機能のIDを指定 | |
var featId4Site = "{E3540C7D-6BEA-403C-A224-1A12EAFEE4C4}"; // SPListNextSiteOptOut for Site | |
// コンテキスト取得 | |
var custCtx = new SP.ClientContext(); | |
// 対象の機能(Feature)を追加(Activate)予約 | |
var feat4Site = custCtx.get_site().get_features().add(new SP.Guid(featId4Site), true, SP.FeatureDefinitionScope.none); | |
// 機能(Feature) オブジェクト取得予約 | |
custCtx.load(feat4Site,'DisplayName'); | |
// サーバーへのクエリー実行(ここまでのコンテキストに含まれる指示予約を送信)custCtx.executeQueryAsync( | |
function() { // クエリー実行時コールバック処理 | |
// 追加した機能(Feature)の名前をコンソールに出力 | |
console.log(feat4Site.get_displayName() + " activated."); | |
}, | |
function(sender, args) { // クエリー失敗時コールバック処理 | |
console.error('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace()); | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment