Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Get a user profile subtype value for a specific User

$
0
0

Hi guy,

i need to get teh value of  a specific user subtype Named "Manger" by code how can i do this?

This i s my wrong code

 string accountName = "dc07\\TestUser";

            using (SPSite site = new SPSite("http://c4968397007"))
            {
                SPServiceContext serviceContext = SPServiceContext.GetContext(site);

                try
                {
                    UserProfileManager userProfileMgr = new UserProfileManager(serviceContext);
                    ProfilePropertyManager profilePropMgr = new UserProfileConfigManager(serviceContext).ProfilePropertyManager;
                    ProfileSubtypePropertyManager subtypePropMgr = profilePropMgr.GetProfileSubtypeProperties("Manager");



                    UserProfile userProfile = userProfileMgr.GetUserProfile(accountName);


                    Console.WriteLine(subtypePropMgr);
                    Console.Read();


                }

                catch (System.Exception e)
                {
                    Console.WriteLine(e.GetType().ToString() + ": " + e.Message);
                    Console.Read();
                }
            }

 

Viewing all articles
Browse latest Browse all 7589

Trending Articles