Second Life of a Hungarian SharePoint Geek

March 17, 2010

7 Comments »

  1. […] sword is too short, take one step forward « Working with profile subtypes from code Creating profile properties and sections the SharePoint 2010 way – part 2, The code […]

    Pingback by Creating profile properties and sections the SharePoint 2010 way – part 1, The theory « Second Life of a Hungarian SharePoint Geek — March 17, 2010 @ 02:57

  2. […] Before we look at creating a feature to deploy our properties, we want to create a property manager for controlling how properties get added and updated in our profile store. Our manager is based on the one described in this excellent post: Creating profile properties and sections the SharePoint 2010 way. […]

    Pingback by Creating Profile Properties « i:0#.f|SharePoint|Development — July 2, 2010 @ 17:39

  3. Hi,

    Great post – something that will be really useful for automation.
    One question though – you mentioned that it is possible to set a TermSet to an existing CoreProperty instance.

    When I try this, this only seems to work for a property that already had a TermSet; but it fails if you try to add a TermSet to a property that previously did not have one (i.e. was presented as IxTaxonomic = false).

    FYI – what I am trying to do is map the default OOTB “Office” property to a TermSet. Unfortunaltey I can’t find a way to do this 😦

    Any help/pointers would be great!

    Comment by Soren — September 15, 2010 @ 13:31

    • Hi Soren,
      This is the code to map a termset for default OOTB property.It worked for me.
      using (SPSite site = new SPSite(“CentralAdminUrl”))
      {
      SPServiceContext context = SPServiceContext.GetContext(site);

      ProfileSubtypeManager psm = ProfileSubtypeManager.Get(context);
      ProfileSubtype ps = psm.GetProfileSubtype(ProfileSubtypeManager.GetDefaultProfileName(ProfileType.User));
      ProfileSubtypePropertyManager pspm = ps.Properties;
      ProfileSubtypeProperty p = pspm.GetPropertyByName(“OOTBPropertyInternalName”);

      TaxonomySession taxonomySession=new TaxonomySession(site);
      TermStore termStore=taxonomySession.TermStores[“MetadataServiceApplicationName”];
      Group group=termStore.Groups[“TaxonomyGroupName”];
      TermSet termSet=group.TermSets[“TermsetName”];
      p.CoreProperty.TermSet=termSet;

      p.CoreProperty.Commit();
      }

      Comment by Vivek — September 24, 2010 @ 15:50

  4. Soren,
    The OOTB “Office” property that you are trying to map to a termset is a non-taxonomical property.So I am not sure if it’ll work for you.

    Comment by Vivek — September 25, 2010 @ 06:35

  5. Awesome post! Congrats!

    Comment by André Rentes — October 19, 2010 @ 14:30

  6. You have a great example, but an enoying width on your webpage. I constantly have to scroll, which is not particular userfriendly

    Comment by kjaps — June 26, 2012 @ 12:40


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: