< Back

Document Subject: Code to Download all Lotusphere 2011 Session slides
Hint Short Cut: Add this to your code & documentation to help you find this page.
http://#LS2011Download or http://A555F9/nn.nsf/ByAlias/LS2011Download

The Lotusphere session slides can be downloaded. I have written some code that will go and grab the 365MB of PDFs. There are 140 files. You need to grab the Genii software session db then add this agent code.




Grab the session database from lotusphere 2011 session here.

Then make a copy, then use the designer to add this code into an agent initialise

' NB You do need a lotusphere 2011 id and password.

%REM
 Agent GrabPDFs
 Created Feb 7, 2011 by Adam Foster http://NotesNinjas.com/#LS2011Download
 Description: Comments for Agent
%END REM
Option Public
Option Declare

Sub Initialize
 
 
 Dim item As Variant
 Dim doc As NotesDocument
 
 Dim s As New NotesSession
 Dim tempdir As string
 tempdir= Environ("Temp") & "\"  
 tempdir = "C:\Temp\"
 
 Dim uid As string
 uid=InputBox("Userid or email address used to register:")
 
 Dim pwd As String
 pwd=InputBox("Confirmation code ")
 
 Dim db As NotesDatabase
 Set db = s.currentdatabase
 Dim fp As string
 Dim v As NotesView
 Set v= db.getview("BySessionID")
 Dim bod As variant
 Dim urldoc As NotesDocument
 'set urldoc = db.GetDocumentByURL(doc.ColorPDF(0),
 Dim urldoc2 As NotesDocument
 Dim emb As NotesEmbeddedObject
 ' Dim urldoc As notesdocument
 Set doc = v.getfirstdocument()
 Dim cnt As Long
 Dim szs As long
 Do Until doc Is Nothing
  cnt=cnt+1
  Print cnt & " of " & v.entrycount & "  " & doc.sessionid(0) & " " & doc.title(0) & " Total downloaded= " & szs/1024 & "k"
  fp=""
  Set bod = doc.getfirstitem("Body")
 If doc.HasItem("ColorPDF") Then
  If doc.colorpdf(0)<>"" Then
   Set urldoc = db.GetDocumentByURL(doc.ColorPDF(0), False,False,"",uid,pwd)
   
   If urldoc.title(0)="Lotusphere Online 2011" Then
    MessageBox "Need to check your id and password, only getting the login page"
   End
   End If
   
   If Not (urldoc Is Nothing) then
   ForAll i In urldoc.Items
    If Not (i Is Nothing) Then
    If i.type = Attachment Then
     Set emb = urldoc.GetAttachment(i.values(0))
      fp=tempdir & emb.name
     Call emb.extractfile(tempdir & emb.name)
     szs=szs + emb.filesize
     If bod.type=RICHTEXT Then
      Call bod.embedobject(EMBED_ATTACHMENT,"", fp)    
     End If
     'Kill fp
     Call urldoc.remove(True)
    End If'att
    End if
   End ForAll
   End if
  End If 'colorpdf Not empty      
 End If' has item  
     
 If doc.HasItem("BWPDF") Then
  If doc.bwpdf(0)<>"" Then
   Set urldoc = db.GetDocumentByURL(doc.BWPDF(0), False,False,"",uid,pwd)
   If Not(urldoc Is nothing) then
   ForAll i In urldoc.Items
    If Not (i Is Nothing) then
    If i.type = Attachment Then
     Set emb = urldoc.GetAttachment(i.values(0))
     fp=tempdir & emb.name
     Call emb.extractfile(tempdir & emb.name)
     szs=szs + emb.filesize
     If bod.type=RICHTEXT Then
      Call bod.embedobject(EMBED_ATTACHMENT,"", fp)    
     End If
     'Kill fp
     Call urldoc.remove(True)
    End If'att
    End if
   End ForAll
   End If' not nothing
  End If 'BWpdf Not empty      
 End If' has item    
     
     
     
 If fp<>"" Then Call doc.save(False,False)
 
 
 Set doc = v.getnextdocument(doc)
 Loop