The goal is to create a custom User Profile property and then set and retrieve its value using C#.
Here’s the best resources on the net for creating, modifying, etc.
- Peter Holpar's Creating profile properties and sections the SharePoint 2010 way - part 2, the code
- MSDN's How to: Modify User Profile Data
Using the above resources, you can piece together how to programatically create custom user profile properties (and sections), set their value(s), and get their value(s). As a developer, you’ve probably only configured enough of your dev farm to get done what you need to do…which isn’t nearly enough to set the values on a custom user profile property.
What else do you need?
Custom User Profile Properties (and several of the Out of Box ones) depend on a Managed Metadata Service Application being setup and associated with the application you’re working with. This is fairly trivial to setup. Just remember that after you set it up via the UI, you’ll need to start it on the “Manage services on this server” page, and then perform an IIS reset. Forgetting these will keep your Managed Metadata service from working.