Blogs

  • Browse Blogs
  • My Blog
  • My Updates

Tags Help

  • View as cloud  | list

Similar Entries

photo

I get to do a Jumpst...

Blog:  kalechi crud
bruce lill
Updated 
No Ratings 0     No Comments 0
photo

Sessions I'm Doing A...

Blog:  Lotus Nut
Chris Whisonant
Updated 
No Ratings 0     No Comments 0
photo

Compile Problem fixe...

Blog:  Jan Schulz
Jan Schulz
Updated 
No Ratings 0     No Comments 0
photo

Lotusphere 2009 Sess...

Blog:  Write it on a...
David Jones
Updated 
No Ratings 0     No Comments 0
photo

Sending Designer int...

Blog:  Jan Schulz
Jan Schulz
Updated 
No Ratings 0     Comments 1

Archive

yellowCAT

Blog Authors:  Marcus Foerster  

Main  | Next

Import Lotusphere Presentations into Lotusphere Session Database

Marcus Foerster  |     |  Tags:  lotusphere lotusphere2008 presentations lotusscript pdf  |  Comments (1)
Categorize all presentations of Lotusphere 2008 in Lotusphere Session Database / Lotusphere Journal via LotusScript import.

As the file names of the Lotusphere presentations contain only the session ids, you might want to import the PDF files into the Lotusphere Session Database ( "Lotusphere Journal 2008" ). This can be done with the LotusScript code below.

This is what you do:

  • Create a LotusScript agent with the code below ( in any Notes database, agent properties / target: "None" )
  • Change the parameters in the code according to your environment: a) the server where your Lotusphere Journal is located, b) path and filename of the Lotusphere Journal, c) path, where the Lotusphere presentations are located on your local machine
  • Run the agent -> each file will be imported into the document with the corresponding session id

Next steps:

  • Edit the form "Journal Entry | JournalEntry" in the Lotusphere Journal and add a richtext field with the name "Presentations" whereever you want the attachment to be displayed in the document (I don't use the existing field "Resources", as there might be hide-when-formulas within the richtext content).
  • Add a column to the view "BySessionID", choose "Display as icon" in the column properties and enter "@If(@Attachments;5;0)" as column formula; this will show a symbol in the view "by session id", when a document contains an attachment.

Have fun!

------------------------------- Import-Code ----------------------------------------------------------

Sub Initialize
   
%REM
Used to import lotusphere PDF presentations into lotusphere journal.
Specify journal server and filepath as well as path to PDF files in parameters below.
In the design of your journal database you might want to do the following:
- open form "Journal Entry | JournalEntry" -> add a richtext item named "Presentations";
  this will contain and display the PDF attachment when opening a session document.
  This agent does not use the existing field "Resources", as there might be hide when formulas
  within the richtext.
- open view "BySessionID" -> add column, choose "display as icon" in column properties and
  enter the following formula code: @If(@Attachments; 5; 0)
  this will display a symbol in the view "by session", when a document contains an attachment
http://marcus.foerster.com/yellowcat
%END REM
   
    On Error Goto errorhandler
   
    ' ###### Parameters ##########
   
    Const lotusphere08Journal_Server = "YOURSERVER" ' server where lotusphere journal is located
    Const lotusphere08Journal_Filepath = "YOURFILEPATH\YOURFILENAME.nsf" ' filepath (path and filename) of lotusphere journal
    Const lotusphere08PDFs_Filepath = "C:\YOURPATHCONTAININGPDFS\" ' filepath (path only) where pdf files are located
   
    ' ##########################
   
    ' open lotusphere08 journal
   
    Dim db As New NotesDatabase(lotusphere08Journal_Server, lotusphere08Journal_Filepath  
    If Not db.IsOpen Then
        Msgbox "Unable to open journal database: " & lotusphere08Journal_Server & "!" & lotusphere08Journal_Filepath
        Exit Sub
    End If
   
    ' get view categorized by session id
   
    Dim v As NotesView
    Set v = db.GetView( "eBySession" )
   
    ' init statistics (success control)
   
    Dim listStat List As Integer
    listStat( "pdf files to be imported" ) = 0
    listStat( "successfully attached" ) = 0
    listStat( "files already attached" ) = 0
    listStat( "corresponding journal entry not found" ) = 0
   
    Dim listNotFound List As String
   
    ' get first pdf file
   
    Dim pathName As String, fileName As String
    pathName$ =lotusphere08PDFs_Filepath
    If Right$(pathName$, 1) <> "\" Then pathName$ = pathName$ + "\"
    fileName$ = Dir$(pathName$ + "*.*", 0)
   
    ' for each pdf file: attach to journal entry
   
    Dim leftfn As String, rightfn As String, vdoc As NotesDocument, rt As NotesRichTextItem, embObj As NotesEmbeddedObject
    Do While fileName$ <> ""
       
        leftfn$ = Strtoken(fileName$, ".", 1)
        rightfn$ = Strtoken(fileName$, ".", 2)
        If Lcase(rightfn$) = "pdf" Or Lcase(rightfn$) = "zip" Then ' only treat pdf and zip
           
            listStat( "pdf files to be imported" ) = listStat( "pdf files to be imported" ) + 1
           
            Print "Importing " + leftfn$
            Set vdoc = v.GetDocumentByKey(leftfn$, True)
           
            If Not vdoc Is Nothing Then
            ' check if PDF has already been attached before
                Set embObj = vdoc.GetAttachment(fileName$)
                If Not embObj Is Nothing Then
                    listStat( "files already attached" ) = listStat( "files already attached" ) + 1               
                Else
                   
            ' get richtext item "Resources"
                    Set rt = vdoc.GetFirstItem( "Presentations" )
                    If rt Is Nothing Then
                        Set rt = New NotesRichTextItem( vdoc, "Presentations" )
                    End If
                   
            ' attach pdf file
                    Call rt.EmbedObject(EMBED_ATTACHMENT, "", pathName$ + fileName$)
                    If vdoc.Save(True, False, False) Then
                        listStat( "successfully attached" ) = listStat( "successfully attached" ) + 1
                    End If
                End If
               
            Else
                listStat( "corresponding journal entry not found" ) = listStat( "corresponding journal entry not found" ) + 1
                listNotFound(leftfn$) = leftfn$               
            End If
           
        End If
       
        fileName$ = Dir$()
    Loop
   
    ' show success statistics
    Dim msg As String
    msg$ = ""
    Forall stat In listStat
        msg$ = msg$ & Listtag(stat) & ": " & stat & Chr$(13)
    End Forall
    Msgbox msg$
   
    msg$ = ""
    Forall notFound In listNotFound
        msg$ = msg$ & Chr$(13) & "- " & notFound
    End Forall       
    If msg$ <> "" Then
        msg$ = "The following session IDs were not found:" & msg$
        Msgbox msg$
    End If
   
e:
    Exit Sub
errorhandler:
    Msgbox "Error " & Error & " in line " & Erl
    Resume e
End Sub

Comments

1 Scott Hooks      Permalink Thanks Marcus. This worked beautifully.


Main  | Next
Skip to main content link. Accesskey S
IBM Lotus Connections Help Tools About

Tags

A tag is a keyword that is used to categorize an entry. To view the entries with a particular tag, click a tag name or enter a tag in the box.
The tag cloud indicates the frequency of tag use. Popular tags appear darkest. The slider control adjusts how many tags are displayed in the tag cloud.