Created
October 4, 2016 10:49
-
-
Save chelnak/1267acd42373f852ee64eae5fe12e3a4 to your computer and use it in GitHub Desktop.
Retrieve the Email Address of a user principal in vRA with vRO
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
- Retrieve the email address of a user principal | |
- Input: vCACCAFEHost [vCACCAFE:vCACHost] | |
- Input: principalId [String] | |
- Output: emailAddress [String] | |
*/ | |
var tenant = vCACCAFEHost.tenant; | |
var authenticationClient = vCACCAFEHost.createAuthenticationClient(); | |
var authenticationPrincipalService = authenticationClient.getAuthenticationPrincipalService(); | |
try { | |
var principal = authenticationPrincipalService.getPrincipal(tenant,principalId); | |
//Principal is a vCACCAFEUser object | |
var emailAddress = principal.getEmailAddress(); | |
} catch (e) { | |
throw "Could not find principal " + principalId + ". " + e; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment