Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Fetch all users in Profile database

  Asked By: Chelsea    Date: May 19    Category: Sharepoint    Views: 1534

Is it possible to retrieve all the users from the Profile Database in a lookup field? I need to display, in a drop-down field, all the current users (authorized) of the Portal. Or is there some other way to achieve this? The end result is an announcement type list with mostly lookup fields as choices for each value of the listing.



10 Answers Found

Answer #1    Answered By: Adrienne Greene     Answered On: May 19

Keep in mind that a profile  import brings in all users  from the source, not just those authorized  to access SharePoint sites.

Answer #2    Answered By: Joshuah Huber     Answered On: May 19

Yes, the purpose of my lookup  is to get a list  of all users  in the company ... I can restrict the users through security group access. Any ideas on how to achieve this?

Answer #3    Answered By: Laura Walker     Answered On: May 19

Actually, you can use a ldap filter on the import connection to bring in only
users that match a certain criteria (ie. Membership in group) to the proflie
databse as well...

Answer #4    Answered By: Keenan Whitehead     Answered On: May 19

I have the users  I need imported already, what I need to do is access them from a list  on a WSS site (V2). I do not want to add everybody to the site but rather pull the user names in and have them available in a drop-down  list. There are ~ 4000 users and the only thing I need is their name.

Answer #5    Answered By: Gopal Jamakhandi     Answered On: May 19

yes the ldap filter is great. We have one applied so that it ignores things such as service accounts and certain users  who don't have access to the portal.

Answer #6    Answered By: Dameon Dejesus     Answered On: May 19

Anyone have any ideas how to do this?

Answer #7    Answered By: Tejaswani Barve     Answered On: May 19

Are the users  who don’t have portal  access flagged in the AD somehow?

I would be interested in seeing how you configured this.

Answer #8    Answered By: Harshita Padwal     Answered On: May 19

Authorized Portal users  are the only users in Active Directory. We use Oracle HR to manage employees and have a script that pulls only the users we need from Oracle HR and uploads / updates their record in AD as needed. The logic to bring a user over or not lies in the PL/SQL package and is based on Position, Title, and Location. So, I guess my addition of "(authorized) users" was a bit of an overstatement as all users in AD have at least read access to the Portal.

I'm trying to avoid creating, and ultimately maintaining a static list  of users. It seems logical to grab the users that are in the Profile database  as the information there is updated nightly, and would give me a dynamic list of users with no additional maintenance points. Another way to achieve this is to add each user to the site, but with > 2500 users, and a fairly significant turnover ratio, maintaining this becomes too cumbersome a task.

I'm guessing that I could use the UserProfile class to extract all the users, but that adds, at least minimumally, another point of custom code maintenance which I'm trying to avoid. This particular client has a lot of custom code now and I would prefer not to add to it, if possible.

Answer #9    Answered By: Jennifer Jones     Answered On: May 19

This works for me, from the xxx_PROF database:

SELECT u.NTName , u.PreferredName , u.email, u.manager, u.bDeleted,
MIN( CASE q.PropertyID WHEN 4 THEN a.PropertyVal END ) AS
FirstName ,
MIN( CASE q.PropertyID WHEN 5 THEN a.PropertyVal END ) AS
FirstName ,
MIN( CASE q.PropertyID WHEN 8 THEN a.PropertyVal END ) AS
WorkPhone ,
MIN( CASE q.PropertyID WHEN 18 THEN a.PropertyVal END ) AS
HomePhone ,
MIN( CASE q.PropertyID WHEN 20 THEN a.PropertyVal END ) AS
Fax ,
MIN( CASE q.PropertyID WHEN 8 THEN a.PropertyVal END ) AS
WorkPhone ,
MIN( CASE q.PropertyID WHEN 11 THEN a.PropertyVal END ) AS
Office ,
MIN( CASE q.PropertyID WHEN 13 THEN a.PropertyVal END ) AS
MIN( CASE q.PropertyID WHEN 14 THEN a.PropertyVal END ) AS
Department ,
MIN( CASE q.PropertyID WHEN 23 THEN a.PropertyVal END ) AS
FROM yourserver.xxxxx_PROF.dbo.UserProfile AS u
JOIN yourserver.xxxxx_PROF.dbo.UserProfileValue As a
ON u.RecordID = a.RecordID
JOIN yourserver.xxxxx_PROF.dbo.PropertyList q
ON q.PropertyID = a.PropertyID
GROUP BY u.NTName , u.PreferredName, u.email, u.manager, u.bDeleted
ORDER BY u.PreferredName

Answer #10    Answered By: Annie Norris     Answered On: May 19

This seems like an excellent opportunity to use a custom field  type. I
describe how to do this in my book. Let me know privately if some sample
code would help.

Didn't find what you were looking for? Find more on Fetch all users in Profile database Or get search suggestion and latest updates.