How can I get a SharePoint user profile via the "Friendly Name" using the SP web service? -


i'm retrieving list of names sharepoint list in client program. names populated name picker in sharepoint. in xml returned list query, list looks this:

"#10;#some name;#12;#another name;#15;#yet anothername" 

my program needs account name (or email address) of each user. can use getuserprofilebyname("domain\\username"), don't have account name. can't getuserprofilebyname("some name") because has account name.

the number before each name index or id, can't use getuserprofilebyindex(10) because have managing own data or have administrator credentials.

so providing me 2 important pieces of information, can't retrieve further information using them.

are sure number index, think might userid site collection. , seems odd sort of user list too, anyway:

string result = "#10;#some name;#12;#another name;#15;#yet anothername"; string[] users = result.substring(1).split(new string[2] { ";", "#" }, stringsplitoptions.removeemptyentries); (int j = 0; j < users.length; j = j + 2) {     using (clientcontext context = new clientcontext("http://yoursite")) {         list list = context.web.siteuserinfolist;         listitem item = list.getitembyid(int.parse(users[j]));         context.load(item, => i.id, => i["name"]);         context.executequery();         object username = item["name"];     } } 

Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -