0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

SharePoint Client Object Model でサイトやサイトコレクションのモダンUIを無効化するコード

Last updated at Posted at 2017-03-23

サイト単位で無効化

// モダン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());
	}
); 

サイトコレクション単位で無効化

// モダン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());
	}
); 
0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?