Click here to Skip to main content
12,898,392 members (56,849 online)
Click here to Skip to main content
Add your own
alternative version


10 bookmarked
Posted 1 May 2008

A Code Project Article Information Library (Part 2)

, 1 May 2008 CPOL
Rate this:
Please Sign up or sign in to vote.
This library provides a framework for using Code Project article information in applications, and provides a utility for extracting user information


This article is part 2 of a series of articles presenting the CodeProject.dll which may be used to extract information about users and articles on CodeProject. In this article the User class is discussed and the functionality expressed. The User class is responsible for obtaining information about a specific user by member number (or ID). The following information may be extracted;

  • Member Name - not to be confused with member id or number
  • User Status - i.e. bronze, silver, gold, or platinum
  • Number of Messages Posted - in both forums and responces to other articles
  • Number of Articles Posted
  • Biography - a short description of the user (may contain some HTML formatting)
  • Location
  • Job Title
  • Company
  • Member Since - date member join Code Project
  • Homepage - URL of personal website
  • Article Comments - list of articles user has commented in recently
  • Forum Comments - list of forums users has commented in recently

PLEASE DO NOT ABUSE THIS LIBRARY. This library allows information to be extracted from the Code Project website, please do retrieve too many user's information at one time or you will effective be performing a denial of service attack. If this happens too often this article will be removed! You have been warned. I would also like to remind Code Project members that it is against the site rules to download lists of users for purposes of distribution for profit or otherwise.


This article is based upon two pages; and The first page is the Who's Who page which contains most information about a specific user. While the second page (which is actually a set of pages) contains a list of recent postings).

Note that in all html source whitespace has been trimmed.

The who's who page contains the following information;

Member Name

<h4><a name="1"/></a>1. 
###member name###</h4>


<b><span id="ctl00_MC_MR_ctl00_S" class="###styleclass###">###status###</span></b>.

Messages Posted

<td style="white-space:nowrap"  class="SmallText"><a id="ctl00_MC_MR_ctl00_MP" 


Messages Posted</a></td>
<td class="SmallText" align="left">###number### - ###category###</td>

Posting status:

  • No Messages have been posted
  • Poster: The member has posted up to 100 messages
  • Regular: The member has posted from 100 up to 1000 messages
  • Personality: The member has posted 1000 up to 5000 messages
  • Fixture: The member has posted over 5000 messages

Articles Posted

<td style="white-space:nowrap"  class="SmallText"><a id="ctl00_MC_MR_ctl00_AS"  


Articles Submitted</a></td>
<td class="SmallText" align="left">###number### - ###category###</td>

Author status:

  • Browser: No Articles have been posted
  • Contributor: The member has submitted up to 4 articles
  • Writer: The member has submitted 5-14 articles
  • Prolific: The member has submitted 15-24 articles
  • Legend: The member has submitted over 25 articles


<td  class="SmallText" align="left" colspan="2" width="100%">###biography###</td>

Note that the biography may contain some HTML formatting; the CodeProject.dll removes <br /> line breaks are replaces with the \r\n notation.


<td class="SmallText">Location</td>
<td  class="SmallText" align="left" colspan="2"><img  


src="###location of country graphic###" alt="###country name###" width="16"  


height="11" /> ###country name###</td>

Note the preceeding space on the ###country name### text.

Job Title

<td class="SmallText">Job Title</td>
<td class="SmallText" align="left" colspan="2">###job title###</td>


<td class="SmallText">Company</td>
<td class="SmallText" align="left" colspan="2">###company###</td>

Member Since

<td class="SmallText">Member since</td>
<td  class="SmallText" align="left">
###day of week###, ###month### ###day of month###, ###year###<br />
(###number of months### months) 


<td class="SmallText">Member since</td>
<td  class="SmallText" align="left">
Friday, January 18, 2008<br />
(3 months) 


<td class="SmallText">Homepage</td>
<td  class="SmallText" align="left"><a id="ctl00_MC_MR_ctl00_H"  



Using the code

The user's portion of the library is based around the User class which has the following events, methods, and properties;

  • User(String userID) - constructor accepts a member id (or number) used to identify the user to Code Project. Also calls update()
  • void update() - updates the object to the latest information; all event firing is a direct result of a call to update
  • List<String> ArticleComments {get;} - returns a list of articles the user has commented on (in no particular order, but with no duplicates)
  • List<String> ForumComments {get;} - returns a list of forums the user has posted in (in no particular order, but with no duplicates)
  • String MemberName {get;} - returns the friendly name of the user (e.g. Derek Bartram)
  • User.Status UserStatus {get;} - returns the user status of the user (e.g. Gold for myself as I have posted between 15-24 articles)
  • int NumberMessagesPosted {get;} - returns the total number of messages posted in articles and the forums
  • int NumberArticlesPosted {get;} - returns the number of articles publically available (not including those removed or not published)
  • String Biography {get;} - returns the biography as a string, with <br /> changed to \r\n
  • String Location {get;} - returns the location of the user
  • String JobTitle {get;} - returns the job title of the user
  • String Company {get;} - returns the company the user works for
  • DateTime MemberSince {get;} - returns the date the user joined Code Project
  • String Homepage {get;} - returns the user's personal homepage
  • event MemberNameChangedEventDelegate MemberNameChanged - Fired when the member name changes*
  • event UserStatusChangedEventDelegate UserStatusChanged - Fired when the user status changes*
  • event NumberMessagesPostedChangedEventDelegate NumberMessagesPostedChanged - Fired when the number of posted messages changes*
  • event NumberArticlesPostedChangedEventDelegate NumberArticlesPostedChanged - Fired when the number of articles posted changes*
  • event BiographyChangedEventDelegate BiographyChanged - Fired when the biography changes*
  • event LocationChangedEventDelegate LocationChanged - Fired when the location changes*
  • event JobTitleChangedEventDelegate JobTitleChanged - Fired when the job title changes*
  • event CompanyChangedEventDelegate CompanyChanged - Fired when the company changes*
  • event MemberSinceChangedEventDelegate MemberSinceChanged - Fired when the member joined date changes (should never be called after initial update())*
  • event HomepageChangedEventDelegate HomepageChanged - Fired when the homepage changes*

Only fired in responces to changes detected during a call to update() (which also occurs during the constructor)

Getting User Information

The following code sample shows how to use the User class to obtain information as per the demo (and screen shot above).

User u = new User("4843375");

Console.WriteLine("Name : " + u.MemberName);
Console.WriteLine("Status : " + u.UserStatus.ToString());
Console.WriteLine("Messages Posted : " + u.NumberMessagesPosted);
Console.WriteLine("Articles Posted : " + u.NumberArticlesPosted);
Console.WriteLine("Location : " + u.Location);
Console.WriteLine("Job Title : " + u.JobTitle);
Console.WriteLine("Company : " + u.Company);
Console.WriteLine("Member Since : " + u.MemberSince.ToString());
Console.WriteLine("Homepage : " + u.Homepage);

Console.WriteLine("Biography : " + u.Biography);

foreach (String articleName in u.ArticleComments)
    Console.WriteLine("Commented in article \"" + articleName + "\"");


foreach (String forum in u.ForumComments)
    Console.WriteLine("Commented in forum \"" + forum + "\"");


Version - Second build of CodeProject.dll, introducing the User class

Useful Links

codeprojectarticle.aspx (Part 1, Articles)

codeprojectuser.aspx (Part 2, Users)

codeprojectkevinbacon.aspx (Part 3, Kevin Bacon)

Additional Licensing Notes

Please feel free to use this in your work, however please be aware that a modified The Code Project Open License (CPOL) is in use; basically it is the same as the standard license except that this code must not be used for commercial or not-for-profit commercial use without prior authorisation. Please see license.txt or license.pdf in the included source and demo files.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Derek Bartram
Software Developer Rail Research UK
United Kingdom United Kingdom
I originally studied for a masters in engineering of software engineering at The University of Birmingham during 2000-2004, of which I received a 2:1. I continued at Birmingham University working with Civil Engineering and Rail Research UK where I am currently in my final year of a 3 year PhD project developing a Computational Intelligent Approach to Railway Intervention Planning. Although my work has a significant focus on railway engineering and associated practices much of my work is with data mining (on SQL Server 2008) and computational intelligence (CI) techniques. My key areas of expertise in CI are clustering algorithms (including Rival Penalised Competitive Learning) and evolutionary algorithms.

Outside of my formal work I enjoy testing the latest technologies such as .NET 3.5 and the many frameworks of which it comprises (mainly WPF). I have several projects on the go including a .NET and DirectX port of Quake 3 and many utility libraries. I also maintain an extensive website coded in Cold Fusion which is regularly updated; more information is available about me there.

You may also be interested in...

Comments and Discussions

QuestionStatus question Pin
DavidCrow19-Apr-10 8:53
mvpDavidCrow19-Apr-10 8:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170424.1 | Last Updated 1 May 2008
Article Copyright 2008 by Derek Bartram
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid