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