Third Light Developer ExchangeYou are not logged in.
Hey devs,
We are trying to use the API to change the owners of several files. The call to change file ownership requires a user account ID, which we need to obtain.
Unfortunately the only method we can see get this info is Users_GetAllUsers, which returns a list of every user on the system. We can then filter down by username or email address.
This is hella inefficient, and kind of a pain to work with. I was wondering if there was a better way to grab the info. (Something along the lines of Users_GetUserIdFromEmail or Users_GetUserIdFromUsername, or even just a query for users.)
Cheers!
Offline
Hi,
I'm afraid that at present there isn't really a better way: when you call Core.ImpersonateUser you can supply user lookup details, and you could extract the user ID from the returned hash - however this probably isn't an improvement overall, since this involves creating and then disposing of a session each time. The response from Users.GetAllUsers should be fairly cacheable, and so the most pragmatic short-term route might be to use this.
I will have a look at exposing the user lookup via the API, we may be able to make that available as it does seem like a reasonable thing to want to do.
Dominic
Offline
Hi,
As of IMS v6.1.8-8, a new method Users.FindUser() is available, and allows you to look up the ID of a user based on their username or e-mail address (or, where relevant, their LDAP user principal or sAMAccountName).
Dominic
Offline
Wow! I'm floored by how fast that was. Thank you!
Offline