Having problems with SharePoint lookup of persons
I've looked and looked but am not finding an answer to my problem.I have a list in SharePoint which has a column named Users. The column is a lookup for persons in our domain. The list displays by name which is our employee ID number (A098xxxx). Now I have a SPDesigner workflow which uses this information in an email. The problem I'm running into is that in the email the name lookup includes our domain, such as ESA/A098xxxx. Now sending emails is not a problem because our Exchange server recognizes the domain prior to the ID number. The problem is that I need the ID number alone for another program that does not know how to deal with the domain preface on the ID.I was thinking, ok just setup a calculcated column and trip the domain off the ID right? Well that would be great except that when I create the calculated column, the Users column does not show up as a field I can select for the calculation. I figured ok, I'll do this in SPDesigner, except that it does not have a function that will allow me to do this either, at least not that I know of.Can anyone suggest a method where a SharePoint list is using the person list item, and where I can trim the domain information from that item and just get the ID number I need?Any help would be greatly appreceated. I am not new to SharePoint or SharePoint Designer and have tried the obvious possible solutions available, but this is beyond my pressent skill set and bugging me. My workflow will not be complete until I can resolve this problem.Todd
February 12th, 2010 7:19pm

Hi, There are two way to deal with your problem. Solution 1. use the below code SPUser oUser = workflowProperties.Web.AllUsers["ESA/A098xxxx"]; you will get everything in the oUser object that u r looking. Solution 2. You can create a custom function that will provide you only id not domain. private string GetUserID(string userName) { string[] userID = userName.Split('\\'); if (userID.Length <= 1) { return string.Empty; } else { return userID[1].ToString(); } } You can use this function that will return only id not domain. like.. string userName = "ind\\sk234"; string ID = GetUserID(userName ); The value of ID is "sk234" Do let me know if you want more detailsSanjiv Kumar
Free Windows Admin Tool Kit Click here and download it now
February 13th, 2010 9:10am

Yep, this worked and I realized it shortly after I posted asking for help. This method allowed me to remove the domain\ from the ID and I was left with just the ID, which is what I needed. Then I appended the @business.com to the end to get my email address - works like a champ. Thanks for the help.Todd
February 24th, 2010 11:01pm

Thanks Sanjiv but the idea here is no code. Our end users must be able to do these things so we are required to do them without code ourselves. Gu Yuming's idea worked for me. I actually discovered it before I checked here but his response was pretty much what I did. I just had to stop using the person/group lookup and put the data into a text field. I was able to get what I needed then. Thanks for the suggestion though. I did not state in the post that this had to be done without code, so my bad.Todd
Free Windows Admin Tool Kit Click here and download it now
February 24th, 2010 11:06pm

Hello, GreatWest, you can also configure how you want your People and Groups field to display. If all you want is the username, you can specify that in the column settings. Go to your list/library > List or Document Library Settings > Click on your column link > scroll down to the Additional Column Settings section and change the Show Field option. This will pull out the username (ID #) that you are looking for.Chris Caravajal MCTS SharePoint Help
July 26th, 2010 4:08pm

Hi Sanjiv, how to populate the user details like full name ,email dynamically based on the user id(we have to give the id) in list columns of newform.aspx Please help!
Free Windows Admin Tool Kit Click here and download it now
June 15th, 2011 8:39am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics