I want to use the CoreService API to get a User object from Tridion. But, instead of using the tcm-id, I want to use the user's domain name, e.g. "ad-ent\xyz"

I don't see a webdav url for the User when I open it in CME. so, do I have any way to find it via CoreService API? I'm not seeing it.

Am I missing it? or is it just not there?

  • Hmm, what's the use case? Unless you're changing users frequently, maybe create a look-up of sorts against all IDs? I'd consider Chris' approach, but do the look-up less frequently and save is somewhere (e.g. memory, XML file, Tridion AppData, etc). – Alvin Reyes Apr 5 '14 at 9:37
  • We do frequent refreshes of our production database to QA environments. Every time we do that, we lose all our QA user accounts and I've been spending an hour recreating them each time. So, I'm looking to automate that process. I will need to load all users first, to check whether user account already exists (which some QA users do exist in production). – Warner Soditus Apr 7 '14 at 12:36

I don't think you will be able to select a single user by name. To select a single user you would need to know their TCMID.

You could select all users, and then LINQ query out the one you are looking for like below

public static UserData GetUserByName(string domain, string name)
    var users = core.GetSystemWideList(new UsersFilterData { BaseColumns = ListBaseColumns.IdAndTitle, IsPredefined = false });

    var user = users.FirstOrDefault(item => item.Title == domain + "\\" + name);

    return user as UserData;

Might be problematic if you have '000s of users, hence getting minimal data IdAndTitle

  • I was afraid that was going to have to be the approach to use :( – Warner Soditus Apr 5 '14 at 1:32
  • 2
    Using the GetSystemWideListXml method should result in a single database operation, and a relatively light-weight amount of data - even if you have a thousand users, it's still not that much data. I agree there could be better ways to do this, but if the data is in the list and you don't need to cast each individual record to a UserData object, you should be OK performance-wise. – Nuno Linhares Apr 7 '14 at 11:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.