Microsoft365 Group Member Add
Adds a user to a Microsoft365 group as a group member.
Configs for this Auto Step
- conf_OAuth2
- A: OAuth 2.0 Setting *
- conf_groupId
- B: destination Group ID *#{EL}
- conf_userId
- C: User ID to add *#{EL}
- conf_log
- X: Access Log (update)
Script (click to open)
// Add Microsoft365 Group Member via Microsoft Graph API v1.0 (ver. 202209)
// (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 requestObj = {};
requestObj['@odata.id'] = 'https://graph.microsoft.com/v1.0/directoryObjects/' + userId;
let accessLog = "";
let uri = "https://graph.microsoft.com/v1.0/groups/" + groupId + "/members/$ref";
let response = httpClient.begin()
.authSetting( oauth2 )
.body( JSON.stringify( requestObj ), "application/json" )
.post( uri );
accessLog += "---POST request--- " + response.getStatusCode() + "\n";
accessLog += response.getResponseAsString() + "\n";
//// == ワークフローデータへの代入 / Data Updating ==
const status = response.getStatusCode();
if( status >= 300 ){
engine.log(accessLog);
throw `Failed in POST request. status: ${status}`;
}
if( dataId_log !== "" ){
engine.setDataByNumber( dataId_log, accessLog );
}
Download
- Microsoft365-Group-Member-Add-202307.xml
- 2023-07-03 (C) Questetra, Inc. (MIT License)
(Installing Addon Auto-Steps are available only on the Professional edition.)
Notes
- About the settings for integration with Microsoft365 services
- How to register applications on the Microsoft365 (Azure Active Directory) side
- How to Setup HTTP Authentication on Questetra side
- “How to Output Files from Cloud-based Workflow Questetra to OneDrive”
- “2.2: OAuth settings on the Questetra side”
- ※ However, the scope is https://graph.microsoft.com/GroupMember.ReadWrite.All offline_access or https://graph.microsoft.com/Group.ReadWrite.All offline_access or https://graph.microsoft.com/Directory.ReadWrite.All offline_access
- “How to Output Files from Cloud-based Workflow Questetra to OneDrive”
Capture
