Logo 
Search:

Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Help me in writing a Query to Import User Profiles

  Asked By: Sonya    Date: May 02    Category: Sharepoint    Views: 2053

Could you please help me in writing the query to import the userprofiles to
profile database from active directory for the scenario below?
I have an application built on SPS 2003.
There is a distribution list named DLMain that contains few users and sub
distribution lists DLSub1, DLSub2 and DLSub3 that again contain few users added
to them

I need to write a query that imports the users to the profile database that
belong to all main distribution list DLMain as well as sub distribution lists
ie., DLSub1, DLSub2 and DLSub3

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Patricia Richardson     Answered On: May 02

Is this are you looking for?

http://support.microsoft.com/kb/827754

 
Answer #2    Answered By: Alexandra Patterson     Answered On: May 02

In sharepoint databae base "MOSS_Shared_DB" a table exist by name of
"UserProfile_Full".
It cotains all users profile of AD. But it is not recommended to query
sharepoint database  directly.


Recommendation:
You should use SharePoint Object Model for this purpose.
Through object mode you can access data in this way



--------------------------------------------------------------------------------\
----
Imports Microsoft.SharePoint
Imports Microsoft.Office.Server.UserProfiles
Imports Microsoft.Office.Server

Dim ds As New DataSet()
Dim dr As DataRow


Dim dc As New DataColumn("Name", Type.[GetType]("System.String"))
Dim dc1 As New DataColumn("Picture", Type.[GetType]("System.String"))
Dim dc2 As New DataColumn("Office", Type.[GetType]("System.String"))

dtLahore.Columns.Add(dc)
dtLahore.Columns.Add(dc1)
dtLahore.Columns.Add(dc2)

Dim currentSite As New SPSite("http://portal/")
Dim context As ServerContext = ServerContext.GetContext(currentSite)
Dim profileManager As New UserProfileManager(context)

For Each profile As UserProfile In profileManager

' Get profile properties
Dim FirstNameProp As UserProfileValueCollection = profile.Item("FirstName")
Dim LastNameProp As UserProfileValueCollection = profile.Item("LastName")
Dim ImageProp As UserProfileValueCollection = profile.Item("PictureURL")
Dim Office As UserProfileValueCollection = profile.Item("Office")

If Office.Value = "Lahore" Then
dr = dtLahore.NewRow()
dr("Name") = FirstNameProp.Value + " " + LastNameProp.Value
dr("Picture") = ImageProp.Value
dr("Office") = Office.Value
dtLahore.Rows.Add(dr)
End If
Next

The above code is just for clue.

Hopefully it will helpful for you.


Ganubp Sun <ganubp.sun@...> wrote:
Dear all,
Could you please help  me in writing  the query  to import  the userprofiles  to
profile database from active  directory for the scenario  below?
I have an application  built on SPS 2003.
There is a distribution list named DLMain that contains few users and sub
distribution lists DLSub1, DLSub2 and DLSub3 that again contain few users added
to them

I need to write a query that imports the users to the profile database that
belong to all main distribution list DLMain as well as sub distribution lists
ie., DLSub1, DLSub2 and DLSub3

 
Didn't find what you were looking for? Find more on Help me in writing a Query to Import User Profiles Or get search suggestion and latest updates.




Tagged: