CNntpClient::ListArticles Method  
 
INT ListArticles(
  LONG nFirstArticle,  
  LONG nLastArticle  
);
INT ListArticles(
  ULONGLONG nFirstArticle,  
  ULONGLONG nLastArticle  
);

The ListArticles method returns a list of articles in the currently selected newsgroup, within the specified article range.

Parameters

nFirstArticle
The first newsgroup article to be returned in the list. If this value is -1, the list will begin with the first available article in the newsgroup.
nLastArticle
The last newsgroup article to be returned in the list. If the value is -1, the list will end with the last available article in the newsgroup.

Return Value

If the method succeeds, the return value is the server result code. If the method fails, the return value is NNTP_ERROR. To get extended error information, call GetLastError.

Remarks

It is possible that there will be gaps in the articles within the range of the first and last articles in the newsgroup. This may be due to a message being canceled or expired. Use the GetFirstArticle and GetNextArticle methods to read the list of articles returned by the server.  If the server can potentially return very large ID values, it is recommended your application use ULONGLONGs (64-bit unsigned integers) instead of LONGs (32-bit signed integers) to store article numbers.

Example

// List all articles in the current group
if (pClient->ListArticles() == NNTP_ERROR)
    pClient->ShowError();
else
{
    NEWSARTICLE newsArticle;
    BOOL bResult;

    // Get each article in the current newsgroup, printing the article
    // number and the subject of the article
    bResult = pClient->GetFirstArticle(&newsArticle);
    while (bResult)
    {
        printf("%ld %s %s\n", newsArticle.nArticleId, newsArticle.szSubject);
        bResult = pClient->GetNextArticle(&newsArticle);
    }
}

Requirements

Minimum Desktop Platform: Windows 7 (Service Pack 1)
Minimum Server Platform: Windows Server 2008 R2 (Service Pack 1)
Header File: cstools10.h
Import Library: csnwsv10.lib
Unicode: Implemented as Unicode and ANSI versions.

See Also

GetArticleRange, GetCurrentArticle, GetFirstArticle, GetNextArticle, ListGroups