I have the following agent. When I run it from my client or designer it works fine. BUT when it runs on schedule on the Domino server. empty documents are created. I am not sure but could problem by related to proxy ??? I get an error code “2146697211” ???
Dim sess As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView, viewopslag As NotesView
Dim RSSprofil As NotesDocument, artikel As notesdocument, docopslag As notesdocument
Dim RSSURL As String, ChannelTitle As String, ChannelLink As String, ChannelDescription As String, nodeName As String, nodeText As String
Dim artikelnummer As Integer
Dim source As Variant
On Error Goto fejl
artikelnummer = 0
Set db = sess.CurrentDatabase
Set viewopslag = db.GetView( "(opslag)" )
Set source = CreateObject("Microsoft.XMLDOM")
Set view = db.GetView( "download" )
Set RSSprofil = view.GetFirstDocument
While Not (RSSprofil Is Nothing)
ChannelName = RSSprofil.subject(0)
Print "ch " + ChannelName
ChannelURL = RSSprofil.url(0)
sourceFile= ChannelURL
source.async = False
source.load(sourceFile)
Print "sourcefile: " + sourceFile
state = source.readystate
Print "St " + state
Print "Err " + source.parseError.errorCode
Print " DDD: " + source.documentElement
Forall x In source.documentElement.selectNodes( "//channel" )
Forall n In x.childnodes
nodeName = n.nodename
nodeText = n.Text
Print "nodeName1 " +nodeText
Select Case nodeName
Case "title" : ChannelTitle = nodeText
Case "link" : ChannelLink = nodeText
Case "description" : ChannelDescription = nodeText
Case "dc:date" : ChannelDate = nodeText
Case "lastBuildDate" : ChannelDate = nodeText
Case "pubDate" : ChannelDate = nodeText
End Select
End Forall
End Forall
Print "URL " + ChannelURL
Forall x In source.documentElement.selectNodes( "//image" )
Forall n In x.childnodes
nodeName = n.nodename
nodeText = n.Text
Select Case nodeName
Case "title" : ImageTitle = nodeText
Case "url" : ImageURL = nodeText
Case "width" : ImageWidth = nodeText
Case "height" : ImageHeight = nodeText
Case "link" : ImageLink = nodeText
End Select
End Forall
End Forall
Forall x In source.documentElement.selectNodes( "//item" )
Set artikel = db.CreateDocument
artikel.form = "avisartikel"
artikel.Channel = ChannelTitle '*** Opretter felter om bl.a. link (URL), billede (Image) m.m.
artikel.ImageTitle = ImageTitle
artikel.ImageURL = ImageURL
artikel.ImageWidth = ImageWidth
artikel.ImageHeight = ImageHeight
artikel.ImageLink = ImageLink
Forall n In x.childnodes
nodeName = n.nodename
nodeText = n.Text
Print "nodeName2 " +nodeText
Select Case nodeName '*** opretter felter udfra tags (elementer)
Case "title" : artikel.Title = nodeText
Case "link" : artikel.Link = nodeText
Case "description" : artikel.Description = nodeText
Case "dc:date" : artikel.Date = nodeText
Case "lastBuildDate" : artikel.Date = nodeText
Case "pubDate" : artikel.Date = nodeText
Case "content:encoded" : artikel.Content = nodeText
End Select
End Forall
Set docopslag = viewopslag.GetDocumentByKey( artikel.Link(0) , True )
If docopslag Is Nothing Then '*** tjekker om artikel allerede er downloaded
Call artikel.Save( True , True )
artikelnummer = artikelnummer + 1
End If
End Forall
ImageTitle = ""
ImageURL = ""
ImageWidth = ""
ImageHeight = ""
ImageLink = ""
RSSprofil.ChannelURL = ChannelURL
RSSprofil.hjemmeside = ChannelLink
Call RSSprofil.Save( True , True )
artikelnummer = 0
Set RSSprofil = view.GetnextDocument( RSSprofil )
Wend
Print "Error: " & source.parseError.reason & "<br> URL:" & RSSprofil.url(0) 'source.url
source = ""
Print "RSS Nyhedsimport"
Exit Sub
fejl:
artikelnummer = 0
Resume Next
End Sub
Thanks for any help!!!