Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Jeffrey Valeroso 40 posts 101 karma points
    Aug 08, 2012 @ 15:07
    Jeffrey Valeroso

    How to populate all Members with Profile properties?

    HI, Im trying to populate all members with profile properties, athough I have successfully done this but It's loading too slow.


      public static XPathNodeIterator GetAllMembers()


                XmlDocument membersXML = new XmlDocument();







                    //For each member in a specific member group

                    foreach (Member memb in Member.GetAll)



                                           //The current member object - get the XML


                            //New XMLNode for <member>

                            XmlNode membNode = membersXML.CreateElement("member");


                            //memberID attribute

                            XmlAttribute membAttrID = membersXML.CreateAttribute("memberID");

                            membAttrID.Value = memb.Id.ToString();



                            foreach (Property prop in memb.getProperties)


                                //Property node

                                XmlNode propNode = membersXML.CreateElement(prop.PropertyType.Alias);


                                //Set the value

                                propNode.InnerText = prop.Value.ToString();


                                //Append Property node to member node




                            //Append to <members> root node






                    return membersXML.CreateNavigator().Select("//members");


                catch (Exception ex)


                    membersXML.LoadXml("<response><success>false</success><error>" + ex.Message.ToString() + "</error></response>");

                    return membersXML.CreateNavigator().Select("/response");



  • Bo Damgaard Mortensen 712 posts 1189 karma points
    Aug 10, 2012 @ 00:42
    Bo Damgaard Mortensen

    Hi Jeffrey,

    When I'm iterating through members I'm using the uQuery extension "GetMembersByXPath(string xpath)" from uComponents. This loads the members from the XML cache instead of loading them from the database by calling Member.GetAll. Should increase performance a lot by doing it this way :-)

    Grab uComponents here: uComponents

    The reference you need are uComponents.Core and you're good to go!

    The XPath code would then look something like this:

    var members = uQuery.GetMembersByXPath("//*");

    Where "members" is your collection of members that you can loop through.

    Let me know if there's any hold-ups :-)

    All the best,


Please Sign in or register to post replies

Write your reply to: