I'm retrieving a list of names from a SharePoint list in my client program. The names are populated from a name picker in SharePoint. In the XML returned from the list query, the list looks like this:
"#10;#Some Name;#12;#Another Name;#15;#Yet AnotherName"
My program needs to get the account name (or the email address) of each user. I can use GetUserProfileByName("domain\\username")
, but I don't have the account name. I can't do something like GetUserProfileByName("Some Name")
because it has to be the account name.
The number before each name is the index or the ID, but I can't use GetUserProfileByIndex(10)
because I have to be managing my own data or have administrator credentials.
So basically it is providing me with two important pieces of information, but I can't retrieve any further information using them.
I have a very messy solution working, but I'd love to hear of some ideas for a proper/elegant solution.
Right now I'm using
GetListItems
on theUserInfo
list and creating a dictionary ofows_ImnName
andows_Name
entries, then parsing the string from the list query into the names and using them as lookup values.There has to be a better way.