Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have configured User Profile Synchronization Service on my Portal and I want to develop a custom Visual WebPart "Employee Directory" to display criteria based results fetched from User Profiles as business card style like this the following.

http://www.sharepointconfig.com/2011/05/how-to-create-a-simple-sharepoint-2010-people-directory/

Here is the source code the way I am iterating the User Profiles using UserProfileManager object...now my question is how to export the results of this code and transform into XSL to come up with the results like the above link as I dont want to use the GRIDVIEW.

using System; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using Microsoft.Office.Server; using Microsoft.Office.Server.UserProfiles; using Microsoft.SharePoint; using System.Data;

namespace VWP_EmployeeDirectory.VisualWebPart1 { public partial class VisualWebPart1UserControl : UserControl { protected void Page_Load(object sender, EventArgs e) { // instantiate DataTable DataTable dtUPSTable = new DataTable("DT_UPSData"); // create columns for the DataTable DataColumn _userID = new DataColumn("UserID", typeof(System.String)); dtUPSTable.Columns.Add(_userID);

DataColumn _WorkPhone = new DataColumn("WorkPhone", typeof(System.String)); dtUPSTable.Columns.Add(_WorkPhone); // populate the DataTable using DataRow object DataRow row = null; //get all user profiles using (SPSite site = new SPSite("http://myportal")) { SPServiceContext context = SPServiceContext.GetContext(site); UserProfileManager userManager = new UserProfileManager(context); foreach (UserProfile user in userManager) { row = dtUPSTable.NewRow(); row["UserID"] = user.MultiloginAccounts[0]; row["WorkPhone"] = user["WorkPhone"].Value; dtUPSTable.Rows.Add(row); } } UPSGridView.DataSource = dtUPSTable; UPSGridView.DataBind(); } }

}

share|improve this question
add comment

1 Answer 1

Have you considered relying on the Search Web Parts which are extremelly fast and flexible as their look&feel is based XSLT. For an example on how you can use SPD to help easier changing XSLT http://techdhaan.wordpress.com/2008/06/03/moss-2007-employee-directory-web-part-using-search-and-data-view-web-parts/

share|improve this answer
    
Well i am new to SharePoint 2010 and so far configured only two services on my portal ..Kerberos and User Profile Synchronization. So to use CoreResultWebPart do i need to enable or setup some kinda Search Service in my web application or I can do it without configuring Search Service? Also I need to query data based on "First Name", "Last Name" "Department", "Location" etc to filter the data. I would appreciate if somebody can guide me what needs to be done to use CoreResultWebPart. –  user342944 Apr 28 '12 at 10:44
    
installed search application :) now want to include query criteria to filter the results ..need guidance. –  user342944 Apr 28 '12 at 15:28
    
do you have UP-SA running with Syncronization enabled? Follow this article by the letter please technet.microsoft.com/en-us/library/ee721049.aspx –  C. Marius - MVP Apr 30 '12 at 8:10
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.