1

I get the list of all users in XElement in Tridion using core services. Now I want to search for a particular user's tcm uri based on the decription?

Chris Summers
  • 10,153
  • 1
  • 21
  • 46
Aquarius24
  • 1,806
  • 6
  • 33
  • 61
  • Are you trying to get the user from the current list (your XElement) or are you trying to query the core service to get the UserData object directly from the CoreService? – Chris Summers Jan 18 '13 at 13:45
  • @ Chris Summers , Right now i am now able to get user details after getting XElement but it would be very helpful if you can tell me the query the to get the UserData object directly from the Tridion using coreservice – Aquarius24 Jan 19 '13 at 19:24

1 Answers1

5

You could use the LINQ to query by the description to get the user TCMURI. This is just one of the approach since you alread have XElement of userlist. You could just use the GetSystemWideList and perform LINQ operations on that as well.

     XElement userListXml = _client.GetSystemWideListXml(
            new UsersFilterData { 
                   BaseColumns = ListBaseColumns.Default, 
                   IsPredefined = false 
             });

     // LINQ to query by description
    var user = (from el in userListXml.Elements()
                where (string) el.Attribute("Description") == "USERDESCRIPTON" 
                select el).FirstOrDefault();

    string usrTcmURI = user.Attribute("ID").Value;
Ram G
  • 4,829
  • 1
  • 16
  • 26