1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / How to access custom profile type in UserProfile

How to access custom profile type in UserProfile

2 posts, 0 answered
  1. Daniel Tharp
    Daniel Tharp avatar
    21 posts
    Registered:
    24 May 2006
    20 Jul 2012
    Link to this post
    I have created a new profile type called ContactID and I can't figure out how to access this custom type to update it. Ive been looking at the documentation but I just can figure it out. This is what Ive tried so far.

    UserProfileManager profileManager = UserProfileManager.GetManager();
    List<
    Telerik.Sitefinity.Security.Model.UserProfile> profiles = profileManager.GetUserProfiles(identity.UserId).ToList();
     
    foreach (Telerik.Sitefinity.Security.Model.UserProfile p in profiles)
                    {
                         
                    }

    In the code above I am getting all UserProfiles for the logged in user but I can't figure out how to get to the custom profile type. Would love some help?

    thanks
  2. Daniel Tharp
    Daniel Tharp avatar
    21 posts
    Registered:
    24 May 2006
    20 Jul 2012
    Link to this post
    UserProfileManager profileManager = UserProfileManager.GetManager();
                    var basicProfile = profileManager.GetUserProfile(identity.UserId, "Telerik.Sitefinity.Security.Model.BasicProfile");
     
                    if (basicProfile..GetValue("ContactID") > 0)
                    {
     
                    }

    So I started to try this but I don't see the GetValue method in the basicProfile object. Any ideas?
2 posts, 0 answered