CNntpClient::ListGroups Method  
 
INT ListGroups(
  LPCTSTR lpszLastUpdated,  
  BOOL bLocalTime  
);

The ListGroups method instructs the server to begin sending a list of newsgroups that were created since the specified date.

Parameters

lpszLastUpdated
Pointer to a string which specifies the date and time that the list of newsgroups were last retrieved from the server. This parameter may be NULL or an empty string, in which case all available newsgroups will be listed by the server.
bLocalTime
A boolean value which indicates if the time specified in the lpszLastUpdated parameter is for the current timezone. If the value is non-zero, the time is assumed to be in the local timezone. If the value is zero, the time is assumed to be in Coordinated Universal Time (UTC).

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

The ListGroups method is used in conjunction with the GetFirstGroup and GetNextGroup methods to enumerate all of the newsgroups that were added to the server since a specific date and time. Typically this is used to provide the user with a list of updated newsgroups to select. To list all of the newsgroups available on the server, omit the arguments to this method.

While the newsgroups are being listed, the client cannot select a newsgroup or retrieve the contents of a specific article. The client should store those newsgroups which it wants to retrieve articles from, and then once all of the newsgroups have been listed, it can then select each newsgroup and retrieve the available articles from that group.

Example

LPCTSTR lpszUpdated = _T("1/1/2004 12:00 AM");

// List all newsgroups that were added after a specific date
if (pClient->ListGroups(lpszUpdated, TRUE) == NNTP_ERROR)
    pClient->ShowError();
else
{
    NEWSGROUP newsGroup;
    BOOL bResult;

    // Get each newsgroup, printing the article range and
    // the name of the group
    bResult = pClient->GetFirstGroup(&newsGroup);
    while (bResult)
    {
        printf("%ld %ld %s\n", newsGroup.nFirstArticle,
                               newsGroup.nLastArticle,
                               newsGroup.szName);
        bResult = pClient->GetNextGroup(&newsGroup);
    }
}

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, GetFirstGroup, GetNextGroup, ListGroups, SelectGroup