locked
How to use SPUser.Name as a data connection RRS feed

  • Question

  • Hi, is it possible to use the fullname of a user as a data connection. I mean I have this dropdown field and the value of the dropdown field is the full name of all the users added to the site. and this will populate another textbox with the group where they belong


    ----------------------- Sharepoint Newbie
    Friday, June 3, 2011 3:07 AM

Answers

  • *Sigh* Don't use First Name and Last Name in your dropdowns.  There should be a FullName that has both names put together in Last Name, First Name format so that all the items can be in alphabetical order by last name.  It does not make sense to force people to choose 2 names in 2 dropdowns.

    The reason why you saw the behavior you saw from above is because you didn't create your rules properly - you likely didn't add a filter, so it's showing only the first row of data.


    SharePoint Architect || Microsoft MVP || My Blog
    Planet Technologies || SharePoint Task Force
    • Marked as answer by David HM Thursday, June 9, 2011 9:20 AM
    Monday, June 6, 2011 2:19 PM

All replies

  • How would a full name be a data connection?  Data connections are lists, libraries, web services, and databases.  How are you populating this dropdown?  Where are you getting this list of users?  What group are you talking about when you say "group where they belong"?  What data source defines this group membership?

    Not sure exactly what you need, but here are some techniques for all the possibilities I can think of for what you might be asking:


    SharePoint Architect || Microsoft MVP || My Blog
    Planet Technologies || SharePoint Task Force
    Friday, June 3, 2011 3:45 AM
  • I am sorry it's not the Group, it is supposed to be the Email Address.

    what I need to do is, i have to dropdown (FName and LName) and a textbox (Email).

    The FName needs to be populated with the first name of all the users added to the site (how to do this?)

    lets say I have these users:

    Test User

    Test1 User1

    Test User2

    Test User3

    When I select Test in the FName dropdown, the FName dropdown will be populated with (User, User2, and User3 except for User1 since Test1 is not his first name)as dropdown values/choices. The user will now choose a FName. after choosing the FName, the Email will be populated


    ----------------------- Sharepoint Newbie
    Friday, June 3, 2011 5:45 AM
  • I completely did not understand your example.

    • Where do these users come from?
    • When you said "I have to dropdown," did you mean TWO dropdowns?  That was very confusing
    • Why would you have a FName dropdown that populates itself after a selection?  YOu said FName dropdown twice.  Did you mean Selecting FName populates the LName dropdown?  This is not what you typed, but it's my best guess.
    • Why would someone select a fist name and then a last name?  Is this a real requirement, or are you just trying to come up with a method?  It doesn't make sense to choose first names.  YOu should be using a Contact Selector first off so that you retrieve actual identities, but even if you absolutely must have a dropdown, it should have full names, not two separate dropdowns.  Why are you trying to design it like this?  What requirements are leading you this way?

    Did you ready any of the articles I showed?  They all show how to do this stuff, but your key is going to be how you populate the dropdown (or dropdowns) to begin with.  There is no data source that can tell you the users who have access to a site, so you would have to have a custom list of users that you manually maintain, which is a poor idea, imo.

    What is SPUser.Name?  It's in your thread title.


    SharePoint Architect || Microsoft MVP || My Blog
    Planet Technologies || SharePoint Task Force
    Friday, June 3, 2011 6:19 AM
  • Hi Clayton, sorry for the confusion:

    • Where do these users come from?

    - these are the added users in the site (people and groups) is this possible?

    • When you said "I have to dropdown," did you mean TWO dropdowns?  That was very confusing

    - i mean "I have TWO dropdown"

    • Why would you have a FName dropdown that populates itself after a selection?  YOu said FName dropdown twice.  Did you mean Selecting FName populates the LName dropdown?  This is not what you typed, but it's my best guess.

    - yes youre right

    • Why would someone select a fist name and then a last name?  Is this a real requirement, or are you just trying to come up with a method?  It doesn't make sense to choose first names.  YOu should be using a Contact Selector first off so that you retrieve actual identities, but even if you absolutely must have a dropdown, it should have full names, not two separate dropdowns.  Why are you trying to design it like this?  What requirements are leading you this way?

    - The setup really have 2 separate columns but I can make it to a 1 dropdown containing the full name of the user, but I don't know where will I look up. My server's configuration does not populate the UserProfile in the ssp admin. is it possible to use the people and group as data source?

    Since adding a list of users in a list is not possible then what will be the alternatives to this?

    sorry for the thread title, i thought the it is possible to use the list of names as a data source

    • Edited by Ton-Ton Keaton Friday, June 3, 2011 6:42 AM added comments
    Friday, June 3, 2011 6:39 AM
  • That is the User Information List, and it has all names added to the entire site collection, but it does not tell you all people who have permissions to your site.  If someone has access through a security group, then they won't show up in that list.

    The UIL is not going to be a reliable source of data for your solution.  Why do you not have profile imports configured?  That's a critical piece of a SharePoint deployment - you're dead in the water without that unless you plan to create a custom web service for retrieving profile data straight from AD (makes little sense when you have it built-in with SharePoint).


    SharePoint Architect || Microsoft MVP || My Blog
    Planet Technologies || SharePoint Task Force
    Friday, June 3, 2011 4:00 PM
  • so does it mean that it is not possible to retrieve the users added in the sharepoint site?

    I'm just new to sharepoint so please bear with me, and oh by the way thanks for this. I learned a lot.


    ----------------------- Sharepoint Newbie
    Monday, June 6, 2011 12:17 AM
  • It may be possible through custom methods, but it's not a built-in feature.  Plus, though I've said it above, I'll state again that there is no way for the site itself to even know all the people who have access, because some people may have permissions through AD security groups.  When this happens, you could have 100 people with permissions to the site without SharePoint being able to show you their names, because SharePoint only knows the group name.


    SharePoint Architect || Microsoft MVP || My Blog
    Planet Technologies || SharePoint Task Force
    Monday, June 6, 2011 6:08 AM
  • If that's the case, the only choice left is to have a custom list with columns First Name, Last Name and Email. I tried it and i think its weird because when I chose a First Name and chose the wrong Last Name, the email address is populated with the email address based on the First Name.

    What I want is, let's say I have this list:

    FirstName               LastName               Email

    Test                       User                      abc@abc.com

    Test1                      User1                    def@def.com

    Test                        User2                    ghi@ghi.com

    Test3                      User3                    jkl@jkl.com

     

    and when I choose Test in the FName dropdown, the LName dropdown will have User and User2 as the choice/values in the dropdown.

    How will I do this?


    ----------------------- Sharepoint Newbie
    Monday, June 6, 2011 7:42 AM
  • *Sigh* Don't use First Name and Last Name in your dropdowns.  There should be a FullName that has both names put together in Last Name, First Name format so that all the items can be in alphabetical order by last name.  It does not make sense to force people to choose 2 names in 2 dropdowns.

    The reason why you saw the behavior you saw from above is because you didn't create your rules properly - you likely didn't add a filter, so it's showing only the first row of data.


    SharePoint Architect || Microsoft MVP || My Blog
    Planet Technologies || SharePoint Task Force
    • Marked as answer by David HM Thursday, June 9, 2011 9:20 AM
    Monday, June 6, 2011 2:19 PM
  • :D I'm sorry about that Clayton, so I will just make it a one-dropdown that has a data connection to a list that have 2 columns (FullName and Email) :) thanks Clayton.
    ----------------------- Sharepoint Newbie
    Tuesday, June 7, 2011 12:15 AM