// We create nntp client object.

NntpClient nntp = new NntpClient();

 

try

{

    // We connect to the nntp server.

    nntp.Connect(_tbNntpServer.Text);

 

    // Get a news group on the server

    // Gets article ids that belong to the "myhost.info" newsgroup and have been added less than one month ago.

    string[] newids = nntp.GetNewArticleIds(_tbNewsgroup.Text, System.DateTime.Now.AddMonths(-1));

 

    // We get each article as an object.

    foreach (string articleId in newids)

    {

        ActiveUp.Net.Mail.Message message = nntp.RetrieveArticleObject(articleId);

        //Display the subject.

        this.AddLogEntry(string.Format("Subject : {0}",message.Subject));

    }

}

 

catch (NntpException pexp)

{

    this.AddLogEntry(string.Format("Nntp Error: {0}", pexp.Message));

}

 

catch (Exception ex)

{

    this.AddLogEntry(string.Format("Failed: {0}", ex.Message));

}

 

finally

{

    if (nntp.IsConnected)

    {

        nntp.Disconnect(); ;

    }

}