I have a request to copy users files from their profiles to their Home drives. I suspect this can be done by sending a button to users that when they click on it the data is copied. The small problem is , I have absolutely no idea how to do this with Lotus Script! Can anybody please provide a sample script that I could modify to get this done?
Subject: Copy files button
you can send an email and put in email button (open memo, set cursor in body, Action\Hotspot\Button, add code which you want to execute)
I hope it will help you.
Subject: This is a simple code that you can use
Sub Click(Source As Button) Dim Session As New NotesSession
Dim Db As NotesDatabase
Dim Object As NotesEmbeddedObject
Set Db=Session.CurrentDatabase
Dim Ws As New NotesUIWorkspace
Dim s As String
FolderName = Ws.SaveFileDialog( True,"Select Folder Name",, "C:\")
If Not Isempty(FolderName) Then
s = FolderName(0)
Dim p1 As Variant
On Error Goto MkDirErr
If Right(s, 1) <> "\" Then s = s & "\"
p1 = 0
While Not p1 >= Len(s)
p1 = Instr(p1 + 1, s, "\")
If p1 = 0 Then p1 = Len(s) + 1
Mkdir Left(s, p1)
Wend
If Right(FolderName(0),1) <> "\" Then FolderName(0) = FolderName(0) & "\"
Dim Coll As NotesDocumentCollection
Set Coll=Db.UnprocessedDocuments
Dim Doc As NotesDocument
Set Doc=Coll.GetFirstDocument
While Not Doc Is Nothing
If Doc.HasEmbedded Then
Set Object = Doc.GetAttachment(Doc.~$File(0))
Call Object.ExtractFile(FolderName(0) & Object.Name)
End If
Set Doc=Coll.GetNextDocument(Doc)
Wend
End If
Exit Sub
MkDirErr:
Resume Next
End Sub
Subject: RE: This is a simple code that you can use
Thanks for that code. It will let me get started.