Domino 9 und frühere Versionen > Entwicklung

Hilfe bei script

(1/4) > >>

piccolo:
hier mein ls-script, das über einen agent laufen sollte, attachment von der derzeitigen db aus einer ansicht heraus lösen und dann in eine andere datenbank übertragen, leider kommt der fehler "variant does not contain an object"

hier das script:


Dim s As New NotesSession  
   Dim SourceDB As NotesDatabase
   Dim TargetDB As NotesDatabase
   Dim dc As NotesDocumentcollection   
   Set TargetDB = s.CurrentDatabase
   Set SourceDB = s.GetDatabase("" , "blablablabla.nsf")
   Set view = SourceDB.GetView( "Memo" )
   
   Dim TargetDoc As NotesDocument
   Dim SourceDoc As NotesDocument
   'Set SourceDoc = view.GetFirstDocument()
   
   Dim object As NotesEmbeddedObject
   Dim ItemType As Integer
   
   Do While Not (SourceDoc Is Nothing)
      
          ' Copy fields from Source Doc to Target Doc
      Set TargetDoc = New NotesDocument( TargetDB )
      TargetDoc.form = "New Document"
      TargetDoc.Category = SourceDoc.heading
      TargetDoc.SubCat = SourceDoc.Category
      TargetDoc.docTitle = SourceDoc.DocHeading
      
          ' Check for attachment(s) in document
      Dim AttachmentName As String
      Dim newObject As NotesEmbeddedObject
      Dim rtitem As NotesRichTextItem
      
          ' Save Attachment from Source Document to Disk
          ' and then attach file from disk to Target Document
      
      Set item = SourceDoc.GetFirstItem("$File")
      If Not (item Is Nothing) Then
         ItemType = item.Type
         
         If ItemType = 1084 Then           ' Item Type is
'ATTACHMENT (not absolutely sure because Notes help does not state the
            'integer values of item Types !)
            
            AttachmentName = item.Values(0)
            Set object = Sourcedoc.GetAttachment(AttachmentName )
            Call object.ExtractFile ( "c:\temp\" & AttachmentName)
            
                    ' Create Attachment in DocContent Field from file on disk
            Set rtitem = New NotesRichTextItem( TargetDoc,"DocContent" )
            Set NewObject = rtitem.EmbedObject (EMBED_ATTACHMENT, "", "c:\temp\" & AttachmentName)
            
                    ' Delete temporary files from c:\temp directory
            Kill "c:\temp\" & AttachmentName
            
         End If
      End If
      
      TargetDoc.Save True,True
      
      Set SourceDoc = view.GetNextDocument( SourceDoc )
      
   Loop
   
   ws.ViewRefresh  

ata:
... ich vermute dir fehlt die session

Dim s As New NotesSession

ata

Korrektur:

... sorry ich habe die erste Zeile übersehen...
... wo steigt denn der Debugger aus?

... Set SourceDoc ist auskommentiert - es wird nicht mehr initialisiert...

piccolo:
hallo ata
der fehler , nach entfernen des kommentars kommt bei setsourcedoc  
  object variable not set

p.s. tschuldigung dass ich nerve, aber ich blicke null mehr durch  ??? 8) ???

Performance:
hast du überhaupt ne view "Memo"  - so heisst die Maske

hast du eine view "Memo" ??

cu

piccolo:
ja, maske "memo" hab ich...... :-[ :-[

Navigation

[0] Themen-Index

[#] Nächste Seite

Zur normalen Ansicht wechseln