|
|
Return information about the first article available in the
current newsgroup.
Syntax
object.GetFirstArticle( ByVal
Article As Variant, [ByVal Subject
As Variant], [ByVal Author As Variant],
[ByVal Posted As Variant], [ByVal
MessageId As Variant], [ByVal
References As Variant], [ByVal
ByteCount As Variant], [ByVal LineCount
As Variant] )
Remarks
The GetFirstArticle method returns information about the
first article in the currently selected newsgroup. This method is
used in conjunction with the GetNextArticle method to
enumerate all of the articles in the newsgroup. Typically this is
used to provide the user with a list of articles to access.
While the articles in the newsgroup are being listed, the client
cannot retrieve the contents of a specific article. For example,
the GetArticle method cannot be called while inside a loop
calling GetNextArticle. The client should store those
articles which it wants to retrieve in an array, and then once all
of the articles have been listed, it can begin calling
GetArticle for each article number to retrieve the article
text.
A program should use either the ListArticles method or
the GetFirstArticle and GetNextArticle methods, but
never in combination with one another. The ListArticles
method is event driven and more suited for asynchronous
connections. The GetFirstArticle and GetNextArticle
methods are more appropriate for scripting languages such as
VBScript.
- Article
- An integer value which specifies the article ID. This is the
number that should be used to access the article on the
server.
- Subject
- A string value which specifies the subject of the article. This
argument is optional and may be omitted if the program does not
require this information.
- Author
- A string value which specifies the author of the article. This
is typically the name and email address of the user who posted the
article. This argument is optional and may be omitted if the
program does not require this information.
- Posted
- A string value which specifies the date that the article was
posted. This argument is optional and may be omitted if the program
does not require this information.
- MessageId
- A string value which specifies the message ID for the article.
Athough it is more common to reference an article by number, it is
possible to reference an article by its message ID. To select a
message by its message ID string, set the MessageID
property. This argument is optional and may be omitted if the
program does not require this information.
- References
- A string which specifies references to the article. This can be
used by an application to create a list of cross references to the
article so that related threads can be provided to the user. This
argument is optional and may be omitted if the program does not
require this information.
- ByteCount
- An integer value which specifies the size of the message in
bytes. This argument is optional and may be omitted if the program
does not require this information.
- LineCount
- An integer value which specifies the number of lines of text in
the message. This argument is optional and may be omitted if the
program does not require this information.
Return Value
A value of true is returned if the operation was successful,
otherwise a return value of false indicates that there are no
articles available in the currently selected newsgroup.
Example
Dim nArticleId As Long
Dim strSubject As String
Dim strAuthor As String
Dim datePosted As Date
Dim strMessageId As String
Dim strReferences As String
Dim nByteCount As Long
Dim nLineCount As Long
Dim bResult As Boolean;
' List each article in the current newsgroup, adding the subject to
' a ListBox control
bResult = NntpClient1.GetFirstArticle(nArticleId, strSubject, strAuthor, _
datePosted, strMessageId, strReferences, _
nByteCount, nLineCount);
Do While bResult
List1.AddItem strSubject
List1.ItemData(List1.NewIndex) = nArticleId
bResult = NntpClient1.GetNextArticle(nArticleId, strSubject, strAuthor, _
datePosted, strMessageId, strReferences, _
nByteCount, nLineCount);
End Do
See Also
Article Property,
MessageID Property,
GetNextArticle Method, ListArticles Method,
|
|