Microsoft365 Group Member List Get
Get Microsoft365 group member list.
Configs for this Auto Step
- conf_OAuth2
- A: OAuth 2.0 Setting *
- conf_groupId
- B: target Group ID *#{EL}
- conf_count
- C: List Count (default:100, MAX:999)#{EL}
- conf_list
- D: Group Member List (update) *
- conf_nextLink
- E: next link URL (update)
- conf_log
- X: Access Log (update)
Script (click to open)
// Get Microsoft365 Group Member List 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" ) + "";
let count = 100;
if ( configs.get( "conf_count" ) ) {
count = configs.get( "conf_count" ) + "";
}
const dataId_list = configs.get( "conf_list" );
const dataId_nextLink = configs.get( "conf_nextLink" );
const dataId_log = configs.get( "conf_log" );
//// == 演算 / Calculating ==
let accessLog = "";
let uri = "https://graph.microsoft.com/v1.0/groups/" + groupId + "/members?$top=" + count;
let response = httpClient.begin()
.authSetting( oauth2 )
.get( uri );
accessLog += "---GET 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}`;
} else {
const jsonObj = JSON.parse( response.getResponseAsString() );
const values = jsonObj.value;
let list = "";
for (let i = 0; i < values.length; i++) {
let value = values[i];
list += value.mail + "\n";
}
engine.setDataByNumber( dataId_list, list );
if( dataId_nextLink !== "" ){
engine.setDataByNumber( dataId_nextLink, jsonObj['@odata.nextLink'] );
}
}
if( dataId_log !== "" ){
engine.setDataByNumber( dataId_log, accessLog );
}
Download
- Microsoft365-Group-Member-List-Get-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 must match the list you wish to retrieve. For example, if you want to retrieve the group member list https://graph.microsoft.com/GroupMember.Read.All offline_access or https://graph.microsoft.com/Group.Read.All offline_access or https://graph.microsoft.com/Directory.Read.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
