Beiträge von Max123

    Hallo Forum-Mitglieder ich möchte die Anhänge in den Dokumenten in Ordner extrahieren.


    Code:
    If Dir$("C:\Projekte (Emre)\Dokumente2014\" + strYear + "\" + o.source$ , 16) = "" Then
    MkDir"C:\Projekte (Emre)\Dokumente2014\" + strYear
    End If
    Call o.ExtractFile( "C:\Projekte (Emre)\Dokumente2014\" + strYear + "\" + o.source )


    Bekomme die Fehlermeldung path Not found..


    Vielen Dank im Voraus

    Sub ExportAttachment(o As Variant)


    Dim sAnhangName As String
    Dim sNum As String
    Dim sTemp As String
    Dim ses As New NotesSession
    Dim db As NotesDatabase
    Dim dc As NotesDocumentCollection
    Dim doc As NotesDocument
    Dim varDatum As Variant
    Dim strJahr As String
    Dim strMonat As String
    Dim strOrdnerName As String

    Set db = ses.CurrentDatabase
    Set dc = db.AllDocuments
    Set doc = dc.GetFirstDocument()
    While Not doc Is Nothing
    varDatum = doc.GetItemValue( "Date" )(0)
    strJahr = CStr( Year( varDatum ) )
    strMonat = CStr( Month( varDatum ) )
    strOrdnerName = strJahr & "\" & strMonat
    MkDir("C:\Projekte\Dokumente")
    Set doc = dc.GetNextDocument( doc )
    Wend


    sAnhangName = sDir & "\" & o.Source
    While Not (Dir$(sAnhangName, 0) = "")
    sNum = Right(StrLeftBack(sAnhangName, "."), 2)
    If IsNumeric(sNum) Then
    sTemp = StrLeftBack(sAnhangName, ".")
    sTemp = Left(sTemp, Len(sTemp) - 2)
    sAnhangName = sTemp & Format$(CInt(sNum) + 1, "##00") & _
    "." & StrRightBack(sAnhangName, ".")
    Else
    sAnhangName = StrLeftBack(sAnhangName, ".") & _
    "01." & StrRightBack(sAnhangName, ".")
    End If
    Wend


    Print "Exporting " & sAnhangName
    'Save the file
    Call o.ExtractFile( sAnhangName )


    End Sub



    Hallo Leute,


    bekomme nun die Fehlermeldung Path/file Access error..


    Ich hoffe Ihr könnt mir weiterhelfen. Bin auf den Fehler einfach nicht draufgekommen.


    Vielen Dank

    Dim sDir As String
    Dim ses As NotesSession
    Dim work As NotesUIWorkspace
    Dim db As NotesDatabase
    Dim dc As NotesDocumentCollection
    Dim doc As NotesDocument


    Sub Initialize


    Set ses = New NotesSession
    Set work = New NotesUIWorkspace
    Set db = ses.CurrentDatabase
    Set dc = db.UnprocessedDocuments
    Set doc = dc.GetFirstDocument
    Dim rtitem As NotesRichTextItem
    Dim RTNames List As String
    Dim DOCNames List As String
    Dim itemCount As Integer
    Dim sDefaultFolder As String
    Dim x As Integer
    Dim vtDir As Variant
    Dim iCount As Integer
    Dim j As Integer
    Dim lngExportedCount As Long
    Dim attachmentObject As Variant


    While Not (doc Is Nothing)


    iCount = 0
    itemCount = 0
    lngExportedCount = 0
    Erase RTNames
    Erase DocNames


    ForAll i In doc.Items


    If i.Type = RICHTEXT Then
    Set rtItem = doc.GetfirstItem(i.Name)
    If Not IsEmpty(rtItem.EmbeddedObjects) Then
    RTNames(itemCount) = CStr(i.Name)
    itemCount = itemCount +1
    End If
    End If


    End ForAll


    For j = 0 To itemCount-1
    Set rtItem = Nothing
    Set rtItem = doc.GetfirstItem(RTNames(j))
    ForAll Obj In rtItem.EmbeddedObjects
    If ( Obj.Type = EMBED_ATTACHMENT ) Then
    Call ExportAttachment(Obj)
    Call doc.Save( False, True )


    End If
    End ForAll
    Next


    ForAll i In doc.Items


    If i.Type = ATTACHMENT Then


    DOCNames(lngExportedCount) = i.Values(0)
    lngExportedCount = lngExportedCount + 1


    End If


    End ForAll


    For j% = 0 To lngExportedCount-1
    Set attachmentObject = Nothing
    Set attachmentObject = doc.GetAttachment(DOCNames(j%))
    Call ExportAttachment(attachmentObject)
    Call doc.Save( False, True )


    Next


    Set doc = dc.GetNextDocument(doc)
    Wend


    MsgBox "Export Complete.", 16, "Finished"


    End Sub



    Sub ExportAttachment(o As Variant)


    Dim ses As New NotesSession
    Dim db As NotesDatabase
    Dim dc As NotesDocumentCollection
    Dim doc As NotesDocument
    Dim varDate As Variant
    Dim strYear As String
    Dim strMonth As String
    Dim strFolderName As String


    Set db = ses.CurrentDatabase
    Set dc = db.AllDocuments
    Set doc = dc.GetFirstDocument()
    While Not doc Is Nothing
    varDate = doc.GetItemValue( "Date" )(0)
    strYear = CStr( Year( varDate ) )
    strMonth = CStr( Month( varDate ) )
    strFolderName = strYear & "\" & strMonth
    Call doc.PutInFolder( strFolderName )
    Set doc = dc.GetNextDocument( doc )
    Wend


    Print "Exporting " & strFolderName


    Call o.ExtractFile( strFolderName )


    End Sub



    Hallo Leute,


    ich bekomme eine Fehlermeldung Type Misstach.


    Ich habe eine Datenbank mit ca. 5000 Dokumenten. Ein Dokument beinhaltet Information wie z.B. Name, Datum, Betrag, Kommentar und ein Body-Feld (meistens .pdf).


    Ich möchte ich die Anhänge.pdf (Body-Feld) in Windows-Explorer exportieren. Das klappt auch. Nun möchte ich aber, dass es
    bisschen sortierter wird, Ordner erstellen lassen mit den Datumswerten und dann in den Ordner die passenden Anhänge.


    Vielen Dank im Voraus


    MFG
    Max

    Sub Initialize


    Dim s As New NotesSession
    Dim db As NotesDatabase
    Dim doc As NotesDocument
    Dim ndc As NotesDocumentCollection
    Dim Datum As Variant
    Dim Jahr As Integer
    Dim Monat As Integer
    Dim folder As NotesView


    Set db = s.currentdatabase
    Set ndc = db.Unprocesseddocuments
    Set ndc = db.Alldocuments
    Set doc = ndc.Getfirstdocument


    Do While Not doc Is Nothing
    Datum = doc.GetItemValue( "Date" )(0)
    Jahr = Year( Datum )
    Monat = Month( Datum )
    Set folder = db.GetView("Jahr")
    Set doc = ndc.Getnextdocument(doc)
    Loop



    End Sub


    Würde das so passen?

    ok alles klar. Habe zuerst auch das Datum als Varian deklariert, dann habe ich in der Hilfe die NoteDateTime Klasse gefunden.


    Und jetzt noch ein Frage ich hoffe, dass du mir dabei auch behilflich sein kannst.


    Wie erstelle ich automatisch jetzt ein Ordner mit dem Ordnernamen und bringe das Dokument in den Ordner rein?

    Hallo Torsten vielen Dank für deine hilfreichen Antworten. Ich bin etwas weitergekommen. Wie pflücke ich das Datum in Jahr und Monat?


    Sub Initialize

    Dim s As New NotesSession
    Dim db As NotesDatabase
    Dim doc As NotesDocument
    Dim ndc As NotesDocumentCollection
    Dim Datum As notesdatetime


    Set db = s.currentdatabase
    Set ndc = db.Unprocesseddocuments
    Set ndc = db.Alldocuments
    Set doc = ndc.Getfirstdocument


    Do While Not doc Is Nothing
    Set Datum = New NotesDateTime(doc.Date(0))
    Set doc = ndc.Getnextdocument(doc)
    Loop





    End Sub



    Vielen Dank im Voraus

    Hallo Leute,


    ich bin vor kurzem in Lotus Notes eingestiegen und hätte da eine Frage an euch. Vorher habe ich mich mit der App Entwicklung beschäftigt. Nun meine Frage.


    ich habe eine Datenbank und in dieser Datenbank sind viele Dokumente. Ein dokument beihnhaltet folgende Felder (Datum, sender, empfänger...). Nun will ich die ganzen Dokumente wie ein Ordnerverzeichnis nach Datum aufbauen, d.h. Ich hab ein Ordner z.B. 2014 und in dem ordner sind unterordner mit dem Monat z.B. 1 für Januar. Diese Datumswerte soll der Agent von dem Feld "Date ablesen" und dann richtig in das jeweilige ordner verschieben. Ist das eigentlich per Agent möglich?


    würde mich auf eine Antwort freuen.
    vielen Dank im Voraus