14.5 Articles Object

Holds a collection of News server articles existing within a specified group.

14.5.1 Count property

Gives the total number of article objects in a particular articles collection.

Syntax

 Object.Count
 

Type

Long.

Attributes

Read-only.

Examples

This example outputs the total number of article objects present in a particular articles collection.

 ’Gets the groups available on the server
 Set news =CreateObject("UCX:INews.news") 
 ’Set the IP address
 news.Server = "164.99.150.93"
 ’Establish connection with the server
 news.Connect()
 Set groups = news.Groups()
 Set group = groups.Item("Test")
 Set articles = group.Articles()
 print articles.Count
 

14.5.2 HasMoreElements property

Indicates whether there are any more article objects existing in the specified articles collection.

Syntax

 Object.HasMoreElements
 

Type

Boolean.

Attributes

Read-only.

Examples

This example indicates whether there are any more article objects present in the articles collection in the group Test and returns the subject of that article.

 ’Gets the groups available on the server
 Set news=CreateObject("UCX:INews.news") 
 ’Set the IP address
 news.Server = "164.99.150.93"
 ’Establish connection with the server
 news.Connect()
 Set groups = news.Groups
 Set group  = groups.Element("Test")
 Set articles = group.Articles
 Status = articles.Hasmoreelements
 Print Status
 
 

14.5.3 Element method

Fetches the article objects corresponding to the specified key values.

Syntax

 Object.Element(
  Key As Variant)
 

Parameters

Key
Can be integer or string value. The string value represents the message ID and the integer value gives the iterated index of the article to be retrieved

Return values

Article object.

Examples

This example fetches the article object from corresponding to the key value "Test", from the group Test and returns the subject of the article.

 ’Gets the groups available on the server
 Set news =CreateObject("UCX:INews.news") 
 ’Set the IP address
 news.Server = "164.99.150.93"
 ’Establish connection with the server
 news.Connect()
 Set groups = news.Groups()
 Set group = groups.Element("Test")
 Set articles = group.Articles()
 Set article = articles.Element("Test")
 print article.Subject
 

14.5.4 Item method

Returns the article objects corresponding to the specified key values.

Syntax

 Object.Item(
  Key As Variant)
 

Parameters

Key
Can be integer or string value. The string value represents the message ID and the integer value gives the iterated index of the article to be retrieved

Return values

Article object.

Examples

This example fetches the article object corresponding to the key value "Test, from the group Test and returns the date on which the article was created.

 ’Gets the groups available on the server
 Set news =CreateObject("UCX:INews.news") 
 ’Set the IP address
 news.Server = "164.99.150.93"
 ’Establish connection with the server
 news.Connect()
 Set groups = news.Groups()
 Set group = groups.Element("Test")
 Set articles = group.Articles()
 Set articles = group.Articles()
 Set article = articles.Item("Test")
 print article.Date
 

14.5.5 Next method

Fetches the next article object from the specified articles collection.

Syntax

 Object.Next()
 

Parameters

None.

Return values

Article object.

Examples

This example fetches the next article object from the specified articles collection in the group Test and returned the subject of the article.

 ’Gets the groups available on the server
 Set news=CreateObject("UCX:INews.news") 
 ’Set the IP address
 news.Server = "164.99.150.93"
 ’Establish connection with the server
 news.Connect()
 Set groups = news.Groups
 Set group  = groups.Element("Test")
 Set articles = group.Articles
 articles.Reset()
 While articles.Hasmoreelements
  Set article =articles.Next()
  Print article.Subject
 Wend
 

14.5.6 Reset method

Resets the current object pointer to the initial point of the articles collection.

Syntax

 Object.Reset()
 

Parameters

None.

Return values

None.

Remarks

When the Next method is called after Reset method, it will fetch the first article object from the collection.

Examples

This example resets the pointer to the initial point of the specified articles collection in the group Test and returns the subject of the current article.

 ’Gets the groups available on the server
 Set news=CreateObject("UCX:INews.news") 
 ’Set the IP address
 news.Server = "164.99.150.93"
 ’Establish connection with the server
 news.Connect()
 Set groups = news.Groups
 Set group  = groups.Element("Test")
 Set articles = group.Articles
 articles.Reset()
 If(err.Number = 0) Then
   Print "The collection is Reset"
 Else
   Print "Unable to reset the collection"
 End if