160 likes | 352 Views
Module 12 Working with SharePoint Server Profiles and Taxonomy APIs. Module Overview. User Profiles Taxonomies Lab: Working with User Profiles and Taxonomies Programmatically. Lesson 1: User Profiles. Overview of User Profiles and Personal Sites Enterprise Search and People Search
E N D
Module 12 Working with SharePoint Server Profiles and Taxonomy APIs
Module Overview • User Profiles • Taxonomies • Lab: Working with User Profiles and Taxonomies Programmatically
Lesson 1: User Profiles • Overview of User Profiles and Personal Sites • Enterprise Search and People Search • Retrieving User Profile Properties • Updating User Profile Properties • Creating Personal Sites Programmatically
Overview of User Profiles and Personal Sites • Each SharePoint user can have a profile • Profile properties • Property behavior • Profile properties can be imported and synchronized • Active Directory • LDAP directory service • Business Connectivity Services entities • Each SharePoint user can have a personal site • Content • Profile properties display • Organizational structure • Colleagues • In Common With feature
Enterprise Search and People Search • People Search is based on indexing user data • Profile properties • Ask Me About values • Social network • Content in personal sites • Enterprise Search incorporates people-related features • Author refiners • Links to personal sites • Presence indicators • FAST Search 2010 for SharePoint includes user contexts • Location • Ask Me About values
Retrieving User Profile Properties • SharePoint 2010 includes new ways of working with user profiles string emailAddr = string.Empty; string personalSite = string.Empty; SPServiceContextsvrCtx = SPServiceContext.Current; uMan = new UserProfileManager(svrCtx); foreach (UserProfileuProfile in uMan) { ProfileSubtypePropertyManagerpropMan = uMan.DefaultProfileSubtypeProperties; string accountName = uProfile["AccountName"].Value.ToString(); if (uProfile["WorkEmail"].Value != null) { emailAddr = uProfile["WorkEmail"].Value.ToString(); } if (uProfile["PersonalSpace"].Value != null) { personalSite = uProfile["PersonalSpace"].Value.ToString(); } }
Updating User Profile Properties • Retrieving a specific profile • GetProfile is overloaded with different options • Set values and then call Commit() SPServiceContextsvrCtx = SPServiceContext.Current; uMan = new UserProfileManager(svrCtx); UserProfileuserProfile = (UserProfile)uMan.GetProfile(true)); string accountName = userProfile["AccountName"].Value.ToString(); intiPos = accountName.IndexOf("\\"); accountName = accountName.Substring(iPos + 1); string updatedEmail = accountName + "@sharepoint.com"; userProfile["WorkEmail"].Value = updatedEmail; userProfile.Commit();
Creating Personal Sites Programmatically • Reference the user’s profile • Call CreatePersonalSite • Privacy issues UserProfileuserProfile = (UserProfile)uMan.GetUserProfile(true)); userProfile.CreatePersonalSite();
Lesson 2: Taxonomies • Overview of Taxonomies • Enterprise Search and Taxonomic Terms • Retrieving Taxonomies Programmatically • Creating Taxonomic Terms Programmatically
Overview of Taxonomies • Business analysts, compliance officers, and other business users define terms and structures for an organization • Hierarchies, categories, and terms are created in the Managed Metadata Service application • Site designers, administrators, and developers can specify list columns as a type of managed metadata
Enterprise Search and Taxonomic Terms • Metadata is extremely important to enterprise search accuracy • Missing or bad values negatively affect the search experience • Requiring users to provide metadata helps improve the search experience • Providing a taxonomy of terms provides consistency for the search experience
Retrieving Taxonomies Programmatically • Taxonomic terms are arranged hierarchically • Session • Store • Group • TermSet • Term SPSitethisSite = SPContext.Current.Site; TaxonomySession session = new TaxonomySession(thisSite); foreach(TermStoretStore in session.TermStores) { Console.WriteLine("Term Store:" + tStore.Name); foreach(Group tGroup in tStore.Groups) { Console.WriteLine(" Group:" + tGroup.Name); foreach(TermSettSet in tGroup.TermSets) { Console.WriteLine(" TermSet:" + tSet.Name); foreach(Term term in tSet.Terms) { Console.WriteLine(" Term:" + term.Name); } } } }
Creating Taxonomic Terms Programmatically • Taxonomic terms are localizable • Creating Groups • Creating TermSets • Creating Terms SPSitethisSite = SPContext.Current.Site; TaxonomySession session = new TaxonomySession(thisSite); Group myGroup = tStore.CreateGroup("My Group"); TermSetmyTermSet = myGroup.CreateTermSet("My Term Set"); Term myTerm = myTermSet.CreateTerm("My Term", 1033);
Lab: Working with User Profiles and Taxonomies Programmatically • Exercise 1: Managing User Profiles • Exercise 2: Working with User Profiles Programmatically Logon information Estimated time: 45 minutes
Lab Review • How did you create user profiles in the user interface? • What did you achieve programmatically with user profiles and personal sites?
Module Review • In this module, you have learned to: • Work with user profiles programmatically • Work with taxonomies programmatically