Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I'm trying to debug the code below. For some reason the GetUserProperties Method isn't called during debug. Can someone tell me how i'm able to call it? I wan't to display the user-properties in an extra tab on the my-sites..

    namespace CV.CV
{
    [ToolboxItemAttribute(false)]
    public class CV : WebPart
    {

        Property propQualifications = null;
        string strQualifications = "";



        public Microsoft.Office.Server.UserProfiles.PropertyCollection GetUserProperties()
        {
            Microsoft.Office.Server.UserProfiles.PropertyCollection oPropertyCollection = null;

            System.Security.PermissionSet ps = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.Unrestricted);
            ps.Assert();

            Microsoft.SharePoint.SPServiceContext serviceContext = Microsoft.SharePoint.SPServiceContext.Current;
            Microsoft.Office.Server.UserProfiles.UserProfileManager upm = new Microsoft.Office.Server.UserProfiles.UserProfileManager(serviceContext);

            oPropertyCollection = upm.PropertiesWithSection;

            propQualifications = oPropertyCollection.GetPropertyByName("Qualifications");
            strQualifications = propQualifications.ToString();

            //Console.WriteLine(strQualifications);

            System.Diagnostics.Debug.WriteLine(propQualifications);

            System.Security.CodeAccessPermission.RevertAssert();

            return oPropertyCollection;
            }
    }
}
share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

You can make a call to your method by overriding either the Page_Load or OnPreRender method of your Web Part.

share|improve this answer
    
can you be a little more specific? im new to the game ;) –  Peter Aug 2 '11 at 9:54
    
just did it! thanks for the advice! –  Peter Aug 2 '11 at 10:19
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.