0

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(); } }

}

1 Answer 1

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/

3
  • 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
    Commented Apr 28, 2012 at 10:44
  • installed search application :) now want to include query criteria to filter the results ..need guidance.
    – user342944
    Commented Apr 28, 2012 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 Commented Apr 30, 2012 at 8:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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