This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to get Email from User Account (vbscript)

Former Member
Former Member
Hello guys,


Is it possible to get the email from a User Account in VBScript?. If yes may I see your sample code?, And in addition, I want to ask you on how to foreach in the multiple user account in vbscript. Thank you in Advance :)


Best Regards, Sean
Parents
  • Former Member
    Former Member
    this line of code is your problem:

    Dim oUA : oUA = PropertyValues.SearchForProperty(1021).TypedValue.DisplayValue ' value of the User Account pv

    you are assuming that you are getting the a user account object here, when in fact you are getting the display value (string) - the user account name

    if your property 1021 is a single select look up of user accounts then try this

    'get the user account id
    Dim iUserAccountId : iUserAccountId = PropertyValues.SearchForProperty(1021).TypedValue.GetLoookupID()
    'get the log in account from the user account ID and get the email address from the login account
    Dim sEM : sEM = Vault.UserOperations.GetLoginAccountOfUser(iUserAccountId).EmailAddress
    Output = sEM
Reply
  • Former Member
    Former Member
    this line of code is your problem:

    Dim oUA : oUA = PropertyValues.SearchForProperty(1021).TypedValue.DisplayValue ' value of the User Account pv

    you are assuming that you are getting the a user account object here, when in fact you are getting the display value (string) - the user account name

    if your property 1021 is a single select look up of user accounts then try this

    'get the user account id
    Dim iUserAccountId : iUserAccountId = PropertyValues.SearchForProperty(1021).TypedValue.GetLoookupID()
    'get the log in account from the user account ID and get the email address from the login account
    Dim sEM : sEM = Vault.UserOperations.GetLoginAccountOfUser(iUserAccountId).EmailAddress
    Output = sEM
Children
No Data