Get LoginAccount information through event handler when an UserAccount is created by External Group synchronization

Hi everyone,

I have an event handler which is triggered when a new user Account is created (After). In my case, the user Account comes from a group in the AD which is synchronised with the vault 

So :

1 - I create the user in the AD

2 - I refresh the synchronisation with my group in M-Files Admin

3 - User account is created

4 - My event handler is triggered (An object is created Frontend)

In my event handler I want to retrieve the user's full name and email. But the problem is that at this point the LoginAccount returns a null and that information should come from the login account and not the user account.

            LoginAccount loginAccount = null;
            MFilesServerApplication mfs = new MFilesServerApplication();
            mfs.ConnectAdministrativeEx();
            try
            {
                loginAccount = mfs.LoginAccountOperations.GetLoginAccount(loginName);
            }
            catch { }

When the script finishes running, the login account appears. Is there a way to refresh in between or something ?

Parents Reply Children
No Data