<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4058429937530071316</id><updated>2011-04-21T15:30:31.908-07:00</updated><title type='text'>An overview on MOSS User Profiles</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://mossuserprofiles.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058429937530071316/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://mossuserprofiles.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Smita Gupta</name><uri>http://www.blogger.com/profile/02491790612918750599</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>1</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4058429937530071316.post-2253443438380412468</id><published>2008-01-28T04:30:00.000-08:00</published><updated>2008-01-28T04:56:20.001-08:00</updated><title type='text'>An Overview on MOSS User Pofiles</title><content type='html'>&lt;strong&gt;Target Readers:&lt;/strong&gt; MOSS 2007 Developers &amp;amp; Designers&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Keywords:&lt;/strong&gt; MOSS User Profiles, MOSS 2007, .Net,C#, Profile Properties, UserProfile, UserProfileManager, User Profile.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Purpose of the Document:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Objective of this document is to throw some light on User profiles in MOSS.&lt;br /&gt;This article will cover following topics:-&lt;br /&gt;&lt;br /&gt;1. Introduction of Moss User Profile and Properties&lt;br /&gt;2. Creating\Updating User Profiles using SharePoint Central Administration&lt;br /&gt;3 Creating\Updating User Profiles and Properties using c# code in visual studio&lt;br /&gt;&lt;strong&gt;&lt;br /&gt;Introduction :&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;Within any organization, a user has a unique id, name, a phone number, an address, a title and maybe even a photograph and many more properties.&lt;br /&gt;In MOSS 2007, this information can be kept in sync with the other systems in the organization using BDC, an Active Directory domain controller, or an LDAP server.&lt;br /&gt;&lt;br /&gt;By default, SharePoint 2007 automatically detects the domain controller and imports the user information from the Active directory service. User profiles can also be imported as per requirement and configured through UI.&lt;br /&gt;&lt;strong&gt;&lt;br /&gt;User Profiles &amp;amp; Properties:-&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;User profile properties are name/value pairs attached to users and used for entering personal information about users (and groups).&lt;br /&gt;For example, you could create a property called "Gender" that contains information regarding gender of the User. User profile properties appear as input fields in the MOSS Portal when you edit a user's profile values.&lt;br /&gt;Profile &amp;amp; its Properties can be accessed/updated/created in following ways:-&lt;br /&gt;&lt;br /&gt;1. Go to Shared Services Administration :-&gt; Shared Service :-&gt; User Profile and Properties&lt;br /&gt;&lt;br /&gt;As shown in snapshot, User Profiles and properties is broadly divided into two sections:&lt;br /&gt;&lt;br /&gt;1) Profile and Import Settings&lt;br /&gt;2) User Profile Properties&lt;br /&gt;&lt;strong&gt;&lt;br /&gt;1) Profile and Import Settings:-&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Profile and Import Settings contain General information about profiles like Number of profiles, Import source etc and also provide links like Add user profile, View user profile etc .&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;2)User Profile Properties:-&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;This section consists two links named Add profile property &amp;amp; View profile Properties.&lt;br /&gt;Some of these properties are public and appear on the public profile page. However, many of these properties are only visible to administrators. Only the SSP administrators can view and edit all user profile properties at the SSP level.&lt;br /&gt;While creating new property, In Default Privacy Settings you can select the visibility level of property like it should be available to only that user, manager or everyone as shown below&lt;br /&gt;While creating new property, by selecting Index checkbox these properties are indexed by MOSS Search engine and available for search .&lt;br /&gt;&lt;br /&gt;In this way, User profile and properties are getting created through SharePoint Central Administration. Users profiles are maintained in the form of Sites called “MY Site” belong to particular SSP, which gets created when the user accesses it for the first time.&lt;br /&gt;&lt;br /&gt;This site can be viewed through Shared Services Administration :-&gt; Shared Service :-&gt; User Profile and Properties :-&gt; View user profiles .List of available profiles will be shown.&lt;br /&gt;&lt;br /&gt;Now click on particular user and select Manage personal site option from the menu .&lt;br /&gt;&lt;br /&gt;When Manage Personal Site is clicked, my site of that user will be opened , which has features like any SharePoint site.&lt;br /&gt;The end user can maintain all relevant information in his or her "My Site" using the "My Profile" link.&lt;br /&gt;&lt;br /&gt;This was the process of creating, managing and updating User profiles and their properties through SharePoint Central Administration.&lt;br /&gt;&lt;br /&gt;This approach requires a lot of manual intervention at each and every step. Moreover each user login is required for my site creation. Besides all this, it can be tedious task if we need to create profiles of 10,000 users. Even though user profile import option is available, it cannot create and update user profiles dynamically or whenever required.&lt;br /&gt;&lt;br /&gt;In all these conditions, rather than using previous approach user profile and properties creation\updation task can be done through code without manual intervention.&lt;br /&gt;&lt;br /&gt;Visual studio .Net provides classes like UserProfileManager, UserProfile to access and update user profiles which are available in dynamic link library named&lt;br /&gt;Microsoft.Office.Server.UserProfiles.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Add References :&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;The following references should be added to the project for accessing User profiles, which is available at location C:\Program Files\Common Files\Microsoft Shared\web&lt;br /&gt;server extensions\12\ISAPI&lt;br /&gt;&lt;br /&gt;· Microsoft.Office.Server&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Add namespace directives :&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;The following namespace directives need to be added to the respective class&lt;br /&gt;&lt;br /&gt;· using Microsoft.Office.Server&lt;br /&gt;· using Microsoft.Office.Server.UserProfiles&lt;br /&gt;&lt;br /&gt;Following code should be added to create\update user profiles in respective class file.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Code Snippet (in c#) for User Profile Creation:- &lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#cc9933;"&gt;&lt;span style="color:#663333;"&gt;public static void CreateUserProfile(string UserAccountName)&lt;br /&gt;{&lt;br /&gt;using (SPSite site = new SPSite("http://moss"))&lt;br /&gt;{&lt;br /&gt;//ServerContext object of current site&lt;br /&gt;ServerContext context = ServerContext.GetContext(site);&lt;br /&gt;//UserProfileManager object to access MOSS user profiles&lt;br /&gt;UserProfileManager profileManager = new UserProfileManager(context);&lt;br /&gt;//Check whether user of given account name exists or not&lt;br /&gt;if(!profileManager.UserExists(UserAccountName))&lt;br /&gt;{&lt;br /&gt;profileManager.CreateUserProfile (UserAccountName)&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#663333;"&gt;}&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#cc9933;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;Code Snippet (in c#) to fetch User Profile &amp;amp; Properties:-&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#663333;"&gt;public static void GetUsername(string UserAccountName)&lt;br /&gt;{&lt;br /&gt;using (SPSite site = new SPSite("http://moss"))&lt;br /&gt;{&lt;br /&gt;//ServerContext object current site&lt;br /&gt;ServerContext context = ServerContext.GetContext(site);&lt;br /&gt;&lt;br /&gt;//UserProfileManager object to access MOSS user profiles&lt;br /&gt;UserProfileManager profileManager = new UserProfileManager(context);&lt;br /&gt;&lt;br /&gt;//Find the user profile of given account name&lt;br /&gt;UserProfile user = profileManager.GetUserProfile(UserAccountName);&lt;br /&gt;&lt;br /&gt;//Fetching the Name of the Current user&lt;br /&gt;if (user [“UserName”].Value != null)&lt;br /&gt;{&lt;br /&gt;String UserName=user [“UserName”].Value.ToString();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;} &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Code Snippet (in c#) to update User profile property:-&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#996633;"&gt;&lt;span style="color:#663333;"&gt;public static void GetUsername(string UserAccountName)&lt;br /&gt;{&lt;br /&gt;using (SPSite site = new SPSite("http://moss"))&lt;br /&gt;{ &lt;/span&gt;&lt;/span&gt;&lt;span style="color:#996633;"&gt;&lt;span style="color:#663333;"&gt;&lt;br /&gt;//ServerContext object of current site&lt;br /&gt;ServerContext context = ServerContext.GetContext(site);&lt;br /&gt;&lt;br /&gt;//UserProfileManager object to access MOSS user profiles&lt;br /&gt;UserProfileManager profileManager = new UserProfileManager(context);&lt;br /&gt;&lt;br /&gt;//Find the user profile of given account name&lt;br /&gt;UserProfile user = profileManager.GetUserProfile(UserAccountName);&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#996633;"&gt;&lt;span style="color:#663333;"&gt;&lt;br /&gt;//Assigning value to Department property of the given user&lt;br /&gt;if (user [“Department”].Value == null)&lt;br /&gt;{&lt;br /&gt;String strDept;&lt;br /&gt;strDept=”Mfgx”:&lt;br /&gt;user[“Department”].Value.ToString()=strDept;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;strong&gt;References:-&lt;br /&gt;&lt;/strong&gt;&lt;span style="color:#3333ff;"&gt;http://msdn2.microsoft.com/en-us/library/bb847941.aspx http://msdn.microsoft.com/msdnmag/issues/05/10/CuttingEdge/&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4058429937530071316-2253443438380412468?l=mossuserprofiles.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mossuserprofiles.blogspot.com/feeds/2253443438380412468/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4058429937530071316&amp;postID=2253443438380412468' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4058429937530071316/posts/default/2253443438380412468'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058429937530071316/posts/default/2253443438380412468'/><link rel='alternate' type='text/html' href='http://mossuserprofiles.blogspot.com/2008/01/overview-on-moss-user-pofiles.html' title='An Overview on MOSS User Pofiles'/><author><name>Smita Gupta</name><uri>http://www.blogger.com/profile/02491790612918750599</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry></feed>
