Skip to content

Instantly share code, notes, and snippets.

@felubra
Last active July 16, 2019 13:28
Show Gist options
  • Save felubra/8dde8962765fd58661d42e72a0dbdb70 to your computer and use it in GitHub Desktop.
Save felubra/8dde8962765fd58661d42e72a0dbdb70 to your computer and use it in GitHub Desktop.
Extracts the user e-mails from the Imail's Web Admin Interface
/***
* Extracts the user e-mails from the Imail's Web Admin Interface.
* Endpoint: UserAdmin.aspx
*/
function getUsersFromComponent(byLine = false) {
const domain = document.querySelector('span#ctl00_ContentPlaceHolder2_dsDomains_lblDomainName').innerText;
const users = ctl00_ContentPlaceHolder2_grdUsers.Data.reduce((accUsers, user) => {
const userName = user[1].toLowerCase();
const isSysAdmin = user[3] === 'Yes';
const isDomainAdmin = user[4] === 'Yes';
const isListAdmin = user[5] === 'Yes';
const isEnabled = user[6] === 'Yes';
if (isEnabled && !(isSysAdmin || isDomainAdmin || isListAdmin)) accUsers.push(userName+'@'+domain);
return accUsers;
}, []);
return byLine ? users.sort().join('\n') : users;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment