Exontrol.ExNNTP - Information, Features

ExNNTP Component

The ExNNTP control is 32-bit light COM that provides easy and flexible way to handle news (NNTP) messages. The Net News Transfer Protocol(NNTP) is a TCP/IP protocol based upon text strings sent bidirectionally over 7 bit ASCII TCP channels. It is used to transfer articles between servers as well as to read and post articles. XOver (overview database ) header are supported. And ExNNTP's Groups and NewsGroups objects which contain Articles objects, which in turn contain Articles, make managing groups and articles very easy. The entire list of articles for any group can easily be downloaded, and left untouched in that Group as other groups are accessed. Once that a message has been sent by the server, the ExNNTP control caches the message for future accessing.

® ExNNTP is a trademark of Exontrol. All Rights Reserved.


Exontrol - Support

How to get support?

To keep your business applications running, you need support you can count on.

Here are few hints what to do when you're stuck on your programming:

  • Check out the samples - they are here to provide some quick info on how things should be done
  • Check out the how-to questions using the eXHelper tool
  • Check out the help - includes documentation for each method, property or event
  • Check out if you have the latest version, and if you don't have it send an update request here.
  • Submit your problem(question) here.

Don't forget that you can contact our development team if you have ideas or requests for new components, by sending us an e-mail at support@exontrol.com ( please include the name of the product in the subject, ex: exgrid ) . We're sure our team of developers will try to find a way to make you happy - and us too, since we helped.

Regards,
Exontrol Development Team

https://www.exontrol.com


constants StateEnum
The StateEnum type specifies the control's state.

Name | Value | Description
LoadingGroups | 0 | LoadingGroups
LoadingArticles | 1 | LoadingArticles
LoadingArticle | 2 | LoadingArticle
LoadingArticleHeader | 3 | LoadingArticleHeader
LoadingArticleBody | 4 | LoadingArticleBody


Article object
The Article object holds information about a news article. Use the Articles property to access the news group's Articles collection. Use the Group or Groups property to access to the news groups available on the server. The Article object supports the following properties and methods.

Name | Description
Article | Displays the header, a blank line, and the body of the article.
Body | Retrieves the article's body.
Header | Retrieves the article's header.
Number | Retrieves the article's number.
XOver | Returns information from the overview database for the article.


property Article

property Article.Article as String
Displays the header, a blank line, and the body of the article.

Type | Description
String | A string expression that indicates the content of the article.
The Article property gives the header and the body of the news article. Use the Body property to retrieve only the body of the article. Use the Header property to get the header of the news article.

The following sample displays the first article in the first group available on the news server:

Dim n As New EXNNTPLibCtl.NNTP

Private Sub Form_Load()
    Dim g As EXNNTPLibCtl.Group
    n.Connect "news.devx.com"
    Set g = n.Groups.Item(0)
    Debug.Print g.Articles.Item(g.Articles.First).Article
    n.Disconnect
End Sub

The following sample displays the first article on the "c++.announcements" news group:

Dim n As New EXNNTPLibCtl.NNTP

Private Sub Form_Load()
    Dim g As EXNNTPLibCtl.Group
    n.Connect "news.devx.com"
    Set g = n.Group("c++.announcements")
    Debug.Print g.Articles.Item(g.Articles.First).Article
    n.Disconnect
End Sub


property Body

property Article.Body as String
Retrieves the article's body.

Type | Description
String | A string expression that specifies the body of the news article.

The Body property specifies the body of the news article. Use the Header property of the article to retrieve the header of the article. Information such of subject of the article can be found on the article's header. Use the Article property to get the text for the entire article including the header and body as well.

The following sample displays the body of the first article in the "c++.general" news group:

Dim n As New EXNNTPLibCtl.NNTP

Private Sub Form_Load()
    Dim g As EXNNTPLibCtl.Group
    n.Connect "news.devx.com"
    Set g = n.Group("c++.general")
    Debug.Print g.Articles.Item(g.Articles.First).Body
    n.Disconnect
End Sub


property Header

property Article.Header as String
Retrieves the article's header.

Type | Description
String | A string expression that indicates the header of the news article.
The Header property contains information such of: subject of the article, the number of the article in the group, the ip address of the sender, the name of the group where the article can be located, the number of lines in the article's body, ... and so on. Information such of subject of the article can be found in the article's header. Use the Body property to access the body of the news article.

The following sample displays the header of the first article in the "vb.general":

Dim n As New EXNNTPLibCtl.NNTP

Private Sub Form_Load()
    Dim g As EXNNTPLibCtl.Group
    n.Connect "news.devx.com"
    Set g = n.Group("vb.general")
    Debug.Print g.Articles.Item(g.Articles.First).Header
    n.Disconnect
End Sub

The header of the article displays information like follows :

From: "Dean" <dean.thomas@exontrol.com>
Newsgroups: vb.general
References: <38c54323@news.devx.com> <38c55540$1@news.devx.com> <38c5b398$1@news.devx.com>
Subject: Re: ActiveX Question - Out of Process Server!
Date: Sat, 11 Mar 2000 19:52:01 -0500
Lines: 76
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.3825.400
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.3825.400
NNTP-Posting-Host: 216.91.107.123
Message-ID: <38cae77c@news.devx.com>
X-Trace: 11 Mar 2000 16:40:28 -0800, 216.91.107.123
Path: news.devx.com!216.91.107.123
Xref: news.devx.com vb.general:36159


property Number

property Article.Number as Long
Retrieves the article's number.

Type | Description
Long | A long expression that indicates the index of the article in the group.

The Number property identifies the article on the news group. The number is assigned by the server, and user cannot change it. Use the Item property of the Articles object to access to an article using its number. Use the First property to get the number of the first article in the news group. Use the Last property to retrieve the number of the last article in the new group. Use the Next property to get the number of the next article on the news group.

The following sample displays the number of the first article in the "vb.general" news group:

Dim n As New EXNNTPLibCtl.NNTP

Private Sub Form_Load()
    Dim g As EXNNTPLibCtl.Group
    n.Connect "news.devx.com"
    Set g = n.Group("vb.general")
    Debug.Print g.Articles.Item(g.Articles.First).Number
    n.Disconnect
End Sub

The following sample uses the First property of the Articles object to retrieve the number of the first article in the "vb.general" news group:

Dim n As New EXNNTPLibCtl.NNTP

Private Sub Form_Load()
    Dim g As EXNNTPLibCtl.Group
    n.Connect "news.devx.com"
    Set g = n.Group("vb.general")
    Debug.Print g.Articles.First
    n.Disconnect
End Sub


property XOver

property Article.XOver as XOver
Returns information from the overview database for the article.

Type | Description
XOver | An XOver expression that indicates the information from the overview database for the article.
The RFC 2980 describes the XOVER command. Use the XOverFields property to get the list of XOVER fields supported. Use the Supported property to check whether the overview information of the article is available. Use the Field property to get a specified field from the article.

The following sample displays the all overview fields available for the first article in the "vb.general" news group:

Dim n As New EXNNTPLibCtl.NNTP

Private Sub Form_Load()
    Dim g As EXNNTPLibCtl.Group, x As EXNNTPLibCtl.XOver
    n.Connect "news.devx.com"
    Set g = n.Group("vb.general")
    Dim s() As String
    s = Split(n.XOverFields, vbCrLf)
    Set x = g.Articles.Item(g.Articles.First).XOver
    For i = LBound(s) To UBound(s)
        Debug.Print "'" & s(i) & "' = " & x.Field(s(i))
    Next
    n.Disconnect
End Sub


Articles object
The Articles object holds articles of the news group. Use the Group property to access a news group by its name. Use the Groups property to access to the news groups available on the server. Use the Articles property to access the news group's articles collection. Use the Item property to access a specified article. The Articles object supports the following properties and methods:

Name | Description
Count | Estimates the number of articles in the news group.
First | Retrieves the number of the first article in the news group.
Item | Returns a specific Article from the Articles collection, based on its number.
Last | Retrieves the number of the last article in the news group.
Next | Retrieves the number of the next article.


property Count

property Articles.Count as Long
Estimates the number of articles in the news group.

Type | Description
Long | A long expression that indicates the number of the news articles in the collection.
Use the First property to get the number of the first article in the news group. Use the Last property to retrieve the number of the last article in the new group. Use the Next property to get the number of the next article on the news group.


property First

property Articles.First as Long
Retrieves the number of the first article in the news group.

Type | Description
Long | A long expression that indicates the number of the article.
The servers uses the number of the article to identify an articles. Use the First property to get the number of the first article in the news group. Use the Last property to retrieve the number of the last article in the new group. Use the Next property to get the number of the next article on the news group.

The following sample displays all subjects in the "security.bugs" news group:

Dim n As New EXNNTPLibCtl.NNTP

Private Sub Form_Load()
    Dim g As EXNNTPLibCtl.Group, a As EXNNTPLibCtl.Article
    n.Connect "news.devx.com"
    Set g = n.Group("security.bugs")

    Dim i As Long
    i = g.Articles.First
    While Not i = -1
        Set a = g.Articles.Item(i)
        Debug.Print a.XOver.Field("Subject")
        i = g.Articles.Next
    Wend
    n.Disconnect
End Sub


property Item

property Articles.Item (Number as Variant) as Article
Returns a specific Article from the Articles collection, based on its number.

Type | Description
Number as Variant | A long expression that indicates the number of the article being requested.
Article | An Article object that holds information about the news article.
Use the First property to get the number of the first article in the news group. Use the Last property to retrieve the number of the last article in the new group. Use the Next property to get the number of the next article on the news group.

The following sample displays all subjects in the "security.bugs" news group:

Dim n As New EXNNTPLibCtl.NNTP

Private Sub Form_Load()
    Dim g As EXNNTPLibCtl.Group, a As EXNNTPLibCtl.Article
    n.Connect "news.devx.com"
    Set g = n.Group("security.bugs")

    Dim i As Long
    i = g.Articles.First
    While Not i = -1
        Set a = g.Articles.Item(i)
        Debug.Print a.XOver.Field("Subject")
        i = g.Articles.Next
    Wend
    n.Disconnect
End Sub


property Last

property Articles.Last as Long
Retrieves the number of the last article in the news group.

Type | Description
Long | A long expression that indicates the number of the last article in the news group.
Use the First property to get the number of the first article in the news group. Use the Last property to retrieve the number of the last article in the new group. Use the Next property to get the number of the next article on the news group.

The following sample displays all subjects in the "security.bugs" news group:

Dim n As New EXNNTPLibCtl.NNTP

Private Sub Form_Load()
    Dim g As EXNNTPLibCtl.Group, a As EXNNTPLibCtl.Article
    n.Connect "news.devx.com"
    Set g = n.Group("security.bugs")

    Dim i As Long
    i = g.Articles.First
    While Not i = -1
        Set a = g.Articles.Item(i)
        Debug.Print a.XOver.Field("Subject")
        i = g.Articles.Next
    Wend
    n.Disconnect
End Sub


property Next

property Articles.Next as Long
Retrieves the number of the next article.

Type | Description
Long | A long expression that indicates the number of the next article, or -1 if the article is not found.
Use the First property to get the number of the first article in the news group. Use the Last property to retrieve the number of the last article in the new group. Use the Next property to get the number of the next article on the news group.

The following sample displays all articles headers in the "security.bugs" news group:

Dim n As New EXNNTPLibCtl.NNTP

Private Sub Form_Load()
    Dim g As EXNNTPLibCtl.Group, a As EXNNTPLibCtl.Article
    n.Connect "news.devx.com"
    Set g = n.Group("security.bugs")
    Dim i As Long
    i = g.Articles.First
    While Not i = -1
        Set a = g.Articles.Item(i)
        Debug.Print a.Header
        i = g.Articles.Next
    Wend
    n.Disconnect
End Sub


Group object
The Group object contains information about a news group. Use the Group property to access a news group by its name. Use the Groups property to access the collection of the news groups available on the server. The Group property supports the following properties and methods:

Name | Description
AllowPost | Retrieves a value that indicates whether the news group allows posting articles.
Articles | Retrieves the Articles collection of the news group.
First | Retrieves a value indicating the number of the first article in the news group.
Last | Retrieves a value indicating the number of the last known article in the news group.
Name | Retrieves the name of the news group.


property AllowPost

property Group.AllowPost as Boolean
Retrieves a value that indicates whether the news group allows posting articles.

Type | Description
Boolean | A boolean expression that indicates whether the news group allows posting articles.
The AllowPost property specifies whether the user can post new articles to the news group.

The following sample displays a boolean value that indicates whether positing new articles is allowed in the "c++.general" news group:

Dim n As New EXNNTPLibCtl.NNTP

Private Sub Form_Load()
    Dim g As EXNNTPLibCtl.Group
    n.Connect "news.devx.com"
    Set g = n.Group("c++.general")
    Debug.Print g.AllowPost
    n.Disconnect
End Sub


property Articles

property Group.Articles as Articles
Retrieves the Articles collection of the news group.

Type | Description
Articles | An Articles collection that holds the news articles collection.
Use the Articles property to access the collection of news articles in the group. Use the Item property to access a particular article in the group. Use the Group property to access a group by its name.

The following sample displays all articles in the "c++.announcements" news group:

Dim n As New EXNNTPLibCtl.NNTP

Private Sub Form_Load()
    Dim g As EXNNTPLibCtl.Group, a As EXNNTPLibCtl.Article
    n.Connect "news.devx.com"
    Set g = n.Group("c++.announcements")
    For Each a In g.Articles
        Debug.Print a.Article
    Next
    n.Disconnect
End Sub


property First

property Group.First as Long
Retrieves a value indicating the number of the first article in the news group.

Type | Description
Long | A long expression that indicates the number of the first article in the news group.
The First property retrieves the number of the first article in the news group. You can use also the First property of the Articles object. Use the Item property to retrieve an article based on its number.

The following sample displays first article in each news group available on the news server:

Dim n As New EXNNTPLibCtl.NNTP

Private Sub Form_Load()
    Dim g As EXNNTPLibCtl.Group
    n.Connect "news.devx.com"
    For Each g In n.Groups
        Debug.Print g.Articles(g.First).Article
    Next
    n.Disconnect
End Sub


property Last

property Group.Last as Long
Retrieves a value indicating the number of the last known article in the news group.

Type | Description
Long | A long expression that indicates the number of the last known article in the news group.
The Last property gets the number of the last article in the news group. Use the Item property to retrieve an article based on its number. Use the First property to get the number of the first article in the news group.

The following sample displays the last article on the each news group from the server:

Dim n As New EXNNTPLibCtl.NNTP

Private Sub Form_Load()
    Dim g As EXNNTPLibCtl.Group
    n.Connect "news.devx.com"
    For Each g In n.Groups
        Debug.Print g.Articles(g.Last).Article
    Next
    n.Disconnect
End Sub


property Name

property Group.Name as String
Retrieves the name of the news group.

Type | Description
String | A string expression that indicates the name of the group.
Use the Name property to identify a group.

The following sample displays all news groups available on the news server:

Dim n As New EXNNTPLibCtl.NNTP

Private Sub Form_Load()
    Dim g As EXNNTPLibCtl.Group
    n.Connect "news.devx.com"
    For Each g In n.Groups
        Debug.Print g.Name
    Next
    n.Disconnect
End Sub


Groups object
The Groups object holds the collection of the news groups available on the news server. Use the Groups property to access the Groups collection. Use the Group property to access a group by its name. The Groups object supports the following properties and methods:

Name | Description
Count | Counts the news groups collection.
Item | Returns a specific Group in the Groups collection.


property Count

property Groups.Count as Long
Counts the news groups collection.

Type | Description
Long | A long expression that indicates the number of available news groups from the server.
The Count property counts the number of the news groups available on the news server.

The following sample prints the number of the news groups:

Dim n As New EXNNTPLibCtl.NNTP

Private Sub Form_Load()
    n.Connect "news.devx.com"
    Debug.Print n.Groups.Count
    n.Disconnect
End Sub

The following sample displays all news groups available on the news server:

Dim n As New EXNNTPLibCtl.NNTP

Private Sub Form_Load()
    Dim g As EXNNTPLibCtl.Group
    n.Connect "news.devx.com"
    For Each g In n.Groups
        Debug.Print g.Name
    Next
    n.Disconnect
End Sub

The following sample displays the news groups available on the news server by using the Item property of the Groups collection:

Dim n As New EXNNTPLibCtl.NNTP

Private Sub Form_Load()
    Dim g As EXNNTPLibCtl.Group
    n.Connect "news.devx.com"
    Dim i As Long
    For i = 0 To n.Groups.Count - 1
        Debug.Print n.Groups(i).Name
    Next
    n.Disconnect
End Sub


property Item

property Groups.Item (Index as Variant) as Group
Returns a specific Group in the Groups collection.

Type | Description
Index as Variant | A long expression that indicates the index of the group in the Groups collection, or a string expression that indicates the group's name.
Group | A Group object being accessed.
The Item property accesses a group by its index. Use the Group property to access a news group by its name. The Group property of the control doesn't list all the news groups on the server. The Item property does list the entire list of news groups. Use the Count property to get the number of the news groups available on the news server.

The following sample displays all news groups available on the news server:

Dim n As New EXNNTPLibCtl.NNTP

Private Sub Form_Load()
    Dim g As EXNNTPLibCtl.Group
    n.Connect "news.devx.com"
    For Each g In n.Groups
        Debug.Print g.Name
    Next
    n.Disconnect
End Sub

The following sample displays the news groups available on the news server by using the Item property of the Groups collection:

Dim n As New EXNNTPLibCtl.NNTP

Private Sub Form_Load()
    Dim g As EXNNTPLibCtl.Group
    n.Connect "news.devx.com"
    Dim i As Long
    For i = 0 To n.Groups.Count - 1
        Debug.Print n.Groups(i).Name
    Next
    n.Disconnect
End Sub


NNTP object
The ExNNTP control is 32-bit light COM that provides easy and flexible way to handle news (NNTP) messages. The Net News Transfer Protocol(NNTP) is a TCP/IP protocol based upon text strings sent bidirectionally over 7 bit ASCII TCP channels. It is used to transfer articles between servers as well as to read and post articles. XOver (overview database ) header are supported. And ExNNTP's Groups and NewsGroups objects which contain Articles objects, which in turn contain Articles, make managing groups and articles very easy. The entire list of articles for any group can easily be downloaded, and left untouched in that Group as other groups are accessed. Once that a message has been sent by the server, the ExNNTP control caches the message for future accessing. The NNTP object supports the following properties and methods:

Name | Description
Busy | Specifies a value that indicates whether the client is busy.
Command | Executes a custom command, and retrieves the response from the server.
Connect | Connects the client to the news server.
Connected | Retrieves a value indicating whether the client is connected to the server.
Date | Converts a DATE value to the YYMMDD format.
Disconnect | Disconnects the client from the server.
Group | Retrieves a specified news group, without listing all news groups.
Groups | Retrieves the news groups collection as returned by the server.
LastError | Retrieves a value that indicates the description of the last error occurred. The description includes also, the error code.
NewGroups | Retrieves a Groups collection indicating the list of News groups created since Date and Time.
Password | Retrieves or sets the user password if the NNTP server requires authorization.
Time | Converts a TIME value to HHMMSS format.
UserName | Retrieves or sets the user name if the NNTP server requires authorization.
XOverFields | Retrieves the XOver list fields.


property Busy

property NNTP.Busy as Boolean
Specifies a value that indicates whether the client is busy.

Type | Description
Boolean | A boolean expression that indicates whether the client is busy.
The control is busy when requesting data from the server. Use the Busy property to notify your application that the control requests data from the server. Use the Connect method to connect to a news server.


property Command

property NNTP.Command (Command as String) as String
Executes a custom command, and retrieves the response from the server.

Type | Description
Command as String | A string expression that indicates the custom command being sent to the news server.
String | A string expression that indicates the response of the news server to the command.
The RFC 977 describes the list of commands and responses that a news server accepts. Use the Command property to send custom commands to the news server. Use the Error event to notify your application that an error occurs on the news server. Use the Date property to convert a DATE value to the YYMMDD format. Use the Time property to convert a TIME value to the HHMMSS format.

The following samples show how we can handle the NEWNEWS command. The syntax for the NEWNEWS command is

NEWNEWS newsgroups date time [GMT] [<distribution>]

The NEWNEWS command gets a list of message-ids of articles posted or received to the specified newsgroup since "date" will be listed. The format of the listing will be one message-id per line, as though text were being sent. A single line consisting solely of one period followed by CR-LF will terminate the list. The samples use also the HEAD and BODY commands to get the header and the body for a specified article base on its identifier.

So, the command that we have to send to the server is "NEWNEWS vb.general " & n.Date(Date). The Command property will get the list of message-ids, line by line. We are using the Split function to get line by line from the response.

The following sample displays the articles that have been posted since yesterday, on a specified news group:

Dim WithEvents n As EXNNTPLibCtl.NNTP

Private Sub Form_Load()
    Dim s As String, a() As String, i As Long
    Set n = New NNTP
    n.Connect "news.devx.com"
    s = n.Command("NEWNEWS vb.general " & n.Date(Date - 1))
    a = Split(s, vbCrLf)
    For i = LBound(a) To UBound(a)
        Debug.Print "--------------------"
        Debug.Print n.Command("HEAD " & a(i))
        Debug.Print "--------------------"
        Debug.Print n.Command("BODY " & a(i))
    Next
End Sub

Private Sub n_Error(ByVal Command As String, ByVal Error As String)
    Debug.Print "Error: " & Error
End Sub

The following sample displays all articles that have been posted since yesterday, from all news groups that start with "vb":

Dim WithEvents n As EXNNTPLibCtl.NNTP

Private Sub Form_Load()
    Dim s As String, a() As String, i As Long
    Set n = New NNTP
    n.Connect "news.devx.com"
    s = n.Command("NEWNEWS vb.* " & n.Date(Date - 1))
    a = Split(s, vbCrLf)
    For i = LBound(a) To UBound(a)
        Debug.Print "--------------------"
        Debug.Print n.Command("HEAD " & a(i))
        Debug.Print "--------------------"
        Debug.Print n.Command("BODY " & a(i))
    Next
End Sub

Private Sub n_Error(ByVal Command As String, ByVal Error As String)
    Debug.Print "Error: " & Error
End Sub


method Connect

method NNTP.Connect (Host as String, [Port as Variant])
Connects the client to the news server.

Type | Description
Host as String | A string expression that indicates the news server. For instance: "news.devx.com", "news.exontrol.com", and so on.
Port as Variant | A long expression that indicates the port number used to communicate with the news server. By default, the Port parameter is 119 as described in the RFC 977.
Return | Description
Boolean | A boolean expression that indicates whether the client succeeded to connect to the server on the specified port.
Use the Connect method to connect to a new server. Use the LastError property to get the last error occurred, if the Connect method fails. Use the UserName and Password properties before calling Connect method if the server requires authorization. Use the Disconnect method to close the connection. Use the Group property to access a particular group by its name after the Connect method is called. Use the events Error, Command, or Result to monitor the data that the client sends to the server, and the data that the server replies to the client's commands.

The following sample connects to a news server and gets the list of available news groups:

Dim n As New EXNNTPLibCtl.NNTP

Private Sub Form_Load()
    If (n.Connect("news.devx.com")) Then
        For Each g In n.Groups
            Debug.Print g.Name
        Next
        n.Disconnect
    End If
End Sub


property Connected

property NNTP.Connected as Boolean
Retrieves a value indicating whether the client is connected to the server.

Type | Description
Boolean | A boolean expression that indicates whether the client is connected to a news server.

Use the Connect method to connect the client to a news server. The Connect method returns True, if the client succeeded to connect to the news server.


property Date

property NNTP.Date (Date as Date) as String
Converts a DATE value to the YYMMDD format.

Type | Description
Date as Date | A DATE expression being converted.
String | A String expression that indicates the YYMMDD format of the Date.
Some commands like NEWNEWS or NEWGROUPS requires dates in the YYMMDD format, where YY is the last two digits of the year, MM is the two digits of the month (with leading zero, if appropriate), and DD is the day of the month (with leading zero, if appropriate). The closest century is assumed as part of the year (i.e., 86 specifies 1986, 30 specifies 2030, 99 is 1999, 00 is 2000). Use the Time property to convert a Time value to HHMMSS format.


method Disconnect

method NNTP.Disconnect ()
Disconnects the client from the server.

Type Description


property Group

property NNTP.Group (Name as String) as Group
Retrieves a specified news group, without listing all news groups.

Type | Description
Name as String | A string expression that indicates the name of the group being accessed.
Group | A Group object being returned.
Use the Group property to access a news group by its name. The Group property of the control doesn't list all the news groups on the server. Use the Groups property to access the collection of the news groups available on the server. Use the Articles property to access any article in the group.

The following sample displays all articles in the "c++.announcements" news group:

Dim n As New EXNNTPLibCtl.NNTP

Private Sub Form_Load()
    Dim g As EXNNTPLibCtl.Group, a As EXNNTPLibCtl.Article
    n.Connect "news.devx.com"
    Set g = n.Group("c++.announcements")
    For Each a In g.Articles
        Debug.Print a.Article
    Next
    n.Disconnect
End Sub


property Groups

property NNTP.Groups as Groups
Retrieves the news groups collection as returned by the server.

Type | Description
Groups | A Groups collection that indicates the news groups available on the server.
Use the Groups property to access the collection of the news groups available on the server. Use the Group property to access a news group by its name. Use the Articles property to access any article in the group.

The following sample displays all news groups from the server:

Dim n As New EXNNTPLibCtl.NNTP

Private Sub Form_Load()
    Dim g As EXNNTPLibCtl.Group
    n.Connect "news.devx.com"
    For Each g In n.Groups
        Debug.Print g.Name
    Next
    n.Disconnect
End Sub


property LastError

property NNTP.LastError as String
Retrieves a value that indicates the description of the last error occurred. The description includes also, the error code.

Type | Description
String | A string expression that indicates the last error occurred.
The LastError property gets the description of the last error occurs, if the Connect method fails. Use the Error event to notify your application when the server replies with an error.


property NewGroups

property NNTP.NewGroups (Date as Variant, Time as Variant, [GMT as Variant], [Distributions as Variant]) as Groups
Retrieves a Groups collection indicating the list of News groups created since Date and Time.

Type | Description
Date as Variant | A DATE expression that indicates the date from when the new groups will be listed.
Time as Variant | A TIME expression that indicates the time from when the new groups will be listed.
GMT as Variant | A boolean expression that indicates whether the the Date and Time are evaluated to the 0 meridian.
Distributions as Variant | A string expression that indicates the list of distribution groups, enclosed in angle brackets.
Groups | A Groups collection being accessed.
The NewGroups property gets a collection of Group objects that have been created since Date/Time. If specified, the Distributions parameter of a new newsgroup (e.g, 'net' in 'net.wombat') will be examined for a match with the distribution categories listed, and only those new newsgroups which match will be listed. If more than one distribution group is to be listed, they must be separated by commas within the angle brackets.

The following sample displays the list of groups being created 1000 days ago:

Dim n As New EXNNTPLibCtl.NNTP

Private Sub Form_Load()
    Dim g As EXNNTPLibCtl.Group
    If (n.Connect("news.devx.com")) Then
        For Each g In n.NewGroups(Date - 1000, Time)
            Debug.Print g.Name
        Next
        n.Disconnect
    End If
End Sub


property Password

property NNTP.Password as String
Retrieves or sets the user password if the NNTP server requires authorization.

Type | Description
String | A string expression that indicates the user's password.
Use the UserName and Password properties to specify the user name and the password if the news server requires authorization. The UserName and Password properties are used by the Connect method, so changing them should happen before calling the Connect method.


property Time

property NNTP.Time (Time as Date) as String
Converts a TIME value to HHMMSS value.

Type | Description
Time as Date | A TIME value being converted.
String | A string expression that indicates the time's format.
Some commands like NEWNEWS or NEWGROUPS requires thetime to be sent in the HHMMSS format, HH being hours on the 24-hour clock, MM minutes 00-59, and SS seconds 00-59. Use the Date property to convert a date value to the YYMMDD format.


property UserName

property NNTP.UserName as String
Retrieves or sets the user name if the NNTP server requires authorization.

Type | Description
String | A String expression that indicates the user name.
Use the UserName and Password properties to specify the user name and the password if the news server requires authorization. The UserName and Password properties are used by the Connect method, so changing them should happen before calling the Connect method.


property XOverFields

property NNTP.XOverFields as String
Retrieves the XOver list fields.

Type | Description
String | A string expression that indicates the list of the name of the supported fields in the overview database.
The RFC 2980 describes the XOVER commands. Use the XOverFields property to access the list of supported fields in the overview database. The XOverFields property implements the "LIST OVERVIEW.FMT" command. Use the Field property of the XOver object to get a specified field from the article.

The following sample displays the all overview fields available for the first article in the "vb.general" news group:

Dim n As New EXNNTPLibCtl.NNTP

Private Sub Form_Load()
    Dim g As EXNNTPLibCtl.Group, x As EXNNTPLibCtl.XOver
    n.Connect "news.devx.com"
    Set g = n.Group("vb.general")
    Dim s() As String
    s = Split(n.XOverFields, vbCrLf)
    Set x = g.Articles.Item(g.Articles.First).XOver
    For i = LBound(s) To UBound(s)
        Debug.Print "'" & s(i) & "' = " & x.Field(s(i))
    Next
    n.Disconnect
End Sub


Runtime object
Tip The /COM object can be placed on a HTML page (with usage of the HTML object tag: <object classid="clsid:...">) using the class identifier: {C8F9F931-9441-4D10-94E2-E3CCE6ABA4D5}. The object's program identifier is: "ExNews.Runtime". The /COM object module is: "ExNNTP.dll"
The Runtime object creates a new and initialized NNTP object on the client's machine.

Name | Description
New | Creates a licensed object at runtime.


property New

property Runtime.New as Object
Creates a licensed object at runtime.

Type | Description
Object | An NNTP object being created and licensed.
Use the New property to create new NNTP objects at runtime on the client's machine.


XOver object
The XOver object holds information from the overview database for the article. Use the XOver property to access the XOver information for an article. The XOver object implements the XOVER command. The RFC 2980 describes the XOVER commands. The XOver object supports the following properties and methods:

Name | Description
Body | Retrieves the command as the server sends it to the client
Field | Retrieves a value that indicates the value for the specified field.
Supported | Retrieves or sets a value that indicates whether the XOVER command is supported.


property Body

property XOver.Body as String
Retrieves the command as the server sends it to the client

Type | Description
String | A string expression that specifies the command to send.
Retrieves the command as the server sends it to the client


property Field

property XOver.Field (Index as Variant) as String
Retrieves a value that indicates the value for the specified field.

Type | Description
Index as Variant | A long expression that indicates the index of the requested field, or a string expression that indicates the name of the field requested.
String | A string expression that indicates the value of the field.
Use the XOver property to access the overview information for an article. Use the Field property of the XOver object to get a specified field from the article. The RFC 2980 describes the XOVER commands. Use the XOverFields property to access the list of supported fields in the overview database.

The following sample displays the all overview fields available for the first article in the "vb.general" news group:

Dim n As New EXNNTPLibCtl.NNTP

Private Sub Form_Load()
    Dim g As EXNNTPLibCtl.Group, x As EXNNTPLibCtl.XOver
    n.Connect "news.devx.com"
    Set g = n.Group("vb.general")
    Dim s() As String
    s = Split(n.XOverFields, vbCrLf)
    Set x = g.Articles.Item(g.Articles.First).XOver
    For i = LBound(s) To UBound(s)
        Debug.Print "'" & s(i) & "' = " & x.Field(s(i))
    Next
    n.Disconnect
End Sub


property Supported

property XOver.Supported as Boolean
Retrieves or sets a value that indicates whether the XOVER command is supported.

Type | Description
Boolean | A boolean expression that indicates whether the XOVER command is supported.
The RFC 2980 describes the XOVER command. Use the XOverFields property to get the list of XOVER fields supported. Use the Supported property to check whether the overview information of the article is available. Use the Field property to get a specified field from the article.

The following sample displays the all overview fields available for the first article in the "vb.general" news group:

Dim n As New EXNNTPLibCtl.NNTP

Private Sub Form_Load()
    Dim g As EXNNTPLibCtl.Group, x As EXNNTPLibCtl.XOver
    n.Connect "news.devx.com"
    Set g = n.Group("vb.general")
    Dim s() As String
    s = Split(n.XOverFields, vbCrLf)
    Set x = g.Articles.Item(g.Articles.First).XOver
    For i = LBound(s) To UBound(s)
        Debug.Print "'" & s(i) & "' = " & x.Field(s(i))
    Next
    n.Disconnect
End Sub


ExNNTP events
Use the NNTP's event to monitor the commands, errors and responses from the client server comunication. The ExNNTP control supports the following events:

Name | Description
Command | Specifies the command that client sends to the server.
Error | Occurs when the server failed to response to the client's command.
Result | Occurs while the client gets any server's response.


event Command

event Command (Command as String)
Specifies the command that client sends to the server.

Type | Description
Command as String | A string expression that indicates the command that client sends to the server.
The Command event monitors the commands that the client sends to the server. Use the WithEvents keyword to declare an object variable for the source of your events.

The following sample displays the command that client sends to the server, and the response from the server. The sample displays the list of news groups available on the server.

Dim WithEvents n As EXNNTPLibCtl.NNTP

Private Sub Form_Load()
    Set n = New NNTP
    n.Connect "news.devx.com"
    Debug.Print n.Command("LIST")
    n.Disconnect
End Sub

Private Sub n_Command(ByVal Command As String)
    Debug.Print Command
End Sub


event Error

event Error (Command as String, Error as String)
Occurs when the server failed to response to the client's command.

Type | Description
Command as String | A string expression that indicates the command that fires the error.
Error as String | A string expression that indicates the description of the error.
Use the Error event to monitor the errors that server sends to the client. The LastError property retrieves the errors based on the connection, not on the server side. If the Error event occurs, the Error parameter contains the error code, and the error description. The RFC 977 describes the errors that a news server gives.

The following sample displays the error that server replies, when LIST2 command is sent. The LIST2 command is not a valid command, that's why the server replies: "500 command not recognized":

Dim WithEvents n As EXNNTPLibCtl.NNTP

Private Sub Form_Load()
    Set n = New NNTP
    n.Connect "news.devx.com"
    Debug.Print n.Command("LIST2")
    n.Disconnect
End Sub

Private Sub n_Error(ByVal Command As String, ByVal Error As String)
    Debug.Print "Error: '" & Command & "' " & Error
End Sub


event Result

event Result (Body as String)
Occurs while the client gets any server's response.

Type | Description
Body as String | A string expression that indicates the response of the server to the client's command.
Use the Result event to monitor the responses from the server. Use the Command event to notify your application about the commands that the client sends to the server. Use the Error event to monitor the errors on the server side.

The following sample displays the command that client sends, and the response from the server. The sample displays the name of the first news group available on the news server.

Dim WithEvents n As EXNNTPLibCtl.NNTP

Private Sub Form_Load()
    Dim g As EXNNTPLibCtl.Group
    Set n = New NNTP
    n.Connect "news.devx.com"
    Set g = n.Groups.Item(0)
    Debug.Print g.Name
    n.Disconnect
End Sub

Private Sub n_Command(ByVal Command As String)
    Debug.Print "Command: " & Command
End Sub

Private Sub n_Result(ByVal Body As String)
    Debug.Print "Result"
    Debug.Print Body
End Sub