Microsoft365 Group Member Delete

Microsoft365 グループメンバー削除

Delete a user from Microsoft365 group member.

Auto Step icon
Configs for this Auto Step
conf_OAuth2
A: OAuth 2.0 Setting *
conf_groupId
B: target Group ID *#{EL}
conf_userId
C: User ID for delete *#{EL}
conf_log
X: Access Log (update)
Script (click to open)


// Delete Microsoft365 Group Member via Microsoft Graph API v1.0 (ver. 202211)
// (c) 2022, Questetra, Inc. (the MIT License)

//// == 工程コンフィグの参照 / Config Retrieving ==
const oauth2  = configs.get( "conf_OAuth2" ) + "";

const groupId = configs.get( "conf_groupId" ) + "";
const userId  = configs.get( "conf_userId" ) + "";

const dataId_log    = configs.get( "conf_log" );

//// == 演算 / Calculating ==
let accessLog = "";
let uri = "https://graph.microsoft.com/v1.0/groups/" + groupId + "/members/" + userId + "/$ref";
let response = httpClient.begin()
  .authSetting( oauth2 )
  .delete( uri );
accessLog += "---DELETE request--- " + response.getStatusCode() + "\n";
accessLog += response.getResponseAsString() + "\n";


//// == ワークフローデータへの代入 / Data Updating ==
const status = response.getStatusCode();

if( status >= 300 ){
  engine.log(accessLog);
  throw `Failed in DELETE request. status: ${status}`;
}
if( dataId_log !== "" ){
  engine.setDataByNumber( dataId_log, accessLog );
}

Download

warning Freely modifiable JavaScript (ECMAScript) code. No warranty of any kind.
(Installing Addon Auto-Steps are available only on the Professional edition.)

Notes

Capture

%d bloggers like this: