We are developing a wizard via an IAS (to be used in Low code app) and would need to get the users mail address.
I found it is possible to get the user display name via the engine object, but how can I get the users mail address?
Hi Mieke,
As far as I know, the only way is via a SLNet message.
Here is a snippet that should help you with this
var securityInfo = engine.SendSLNetSingleResponseMessage(new GetInfoMessage(InfoType.SecurityInfo)) as GetUserInfoResponseMessage;
Dictionary<string, string> emails = new Dictionary<string, string>();
foreach (var user in securityInfo.Users)
{
emails.Add(user.FullName, user.EmailAdress);
}
If you do not need all email addresses you can replace the dictionary and the emails.Add with a simple filter, like below
var email = securityInfo?.Users?.FirstOrDefault(user => user.FullName == engine.UserDisplayName)?.EmailAdress;
There is also a FindUserByLoginName method that can be used instead of the Linq query. See https://community.dataminer.services/question/sending-an-email-to-the-dataminer-user-that-starts-the-script/answer/105295/.