volume_up

A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More

volume_up

A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More

List all user profiles

Hello!

 

Im trying to list all the user profiles on my website in a list.

I have registered some users and given them roles who have read rights on my episerver site.

I have successfully printed out some basic profile information in a gridview. However I cant add/print out some more information like FirstName, LatName and so on.

 

my code:

The viewlist template codebehind in the onload method:

EPiServerProfile.Current.FirstName = "hej";


            List<ProfileInfo> profiles = new List<ProfileInfo>();

            foreach (ProfileInfo profile in ProfileManager.GetAllProfiles(ProfileAuthenticationOption.All))
            {
                profiles.Add(profile);
            }

            gridviewer.DataSource = profiles;
            gridviewer.DataBind();

 

 

and my template:

<asp:Content ID="Content2" runat="server" ContentPlaceHolderID="MainContent">
   
    <asp:GridView ID="gridviewer" runat="server">
   
    </asp:GridView>

</asp:Content>

 

It prints out some basic info like username, and latest activity but not my FirstName property.

What am I doing wrong here?

 

#52125
Jul 07, 2011 13:06
Vote:

Never mind.  I solved it :) kinda obvious. I used the Episerveprofile instead of profileinfo. But not so obvious when you have spend all morning pulling your hair with all kinds of different aproaches heheh :)

 

List<EPiServerProfile> profiles = new List<EPiServerProfile>();

            foreach (EPiServerProfile profile in EPiServerProfile.GetProfiles("IteraUser"))
            {
                profiles.Add(profile);
            }

            gridviewer.DataSource = profiles;
            gridviewer.DataBind();

#52127
Edited, Jul 07, 2011 13:17
error This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.