'Sample Script to demontrate the use of the nntp interface
'The use of this script is to copy news from one server to an other
'please refer also to http://www.aloaha.com/mmc/faq/faq.php?list=all&prog=NNTP&lang=en&onlynewfaq=0
'and www.aloaha.com
'minimum version of SDK is 3.0.26

On Error Resume Next

'maximum messages to copy
Max=100

'create sourceobject
Set news1=CreateObject("pop3news.popnews")

'create targetobject
Set news2=CreateObject("pop3news.popnews")

'Set server and port of source
news1.remotehost="news.microsoft.com"
news1.remoteport="119"

'Set server and port of source
news2.remotehost="192.168.0.111"
news2.remoteport="119"

'choose newsgroup
group="microsoft.public.exchange2000.general"

'enter group
dummy=news1.enter_group(CStr(group))
'MsgBox dummy
dummy=news2.enter_group(CStr(group))
'MsgBox dummy

Dim i
i=0

'Get latest newsindex on source
dummy=CStr(news1.lastnews)
'MsgBox dummy
   
Do While i<Max
   'Choose latest news and get Message-ID
   err.clear
   dummy=Trim(split(news1.choose_message(CStr(dummy)))(2))
   If err.number=0 Then
   	news1.lastnews=CStr(dummy)
   	'MsgBox dummy
   	If dummy<>"" Then
   		'try to choose same message on target server
   		dummy=news2.choose_message(CStr(dummy))
   		'if dummy="" then message does not exist on target
   		If dummy="" Then
   			ret = news2.post_nntp_message(news1.get_article_as_CDO(CStr(news1.lastnews)), CStr(news2.remotehost), "119", CStr(group), "", "", "")
   			dummy=news1.choose_next_message
   			i=i+1
		End If
   	Else
   		i=max+1
   	End If
   Else
   	dummy=news1.choose_next_message
   	i=i+1
   End if
loop

Set news1=nothing
Set news2=nothing