Lotus Notes R5 : Sauvegarde des emails

Lotus Notes R5 : Sauvegarde des emails - Logiciels d'entreprise - Systèmes & Réseaux Pro

Marsh Posté le 28-10-2009 à 11:42:50    

Bonjour
 
Je termine de mettre en place eGroupware pour un parc de 400 machines.
Une partie des utilisateurs utilisent Lotus Notes R5. J'ai pu exporter les calendriers et les contacts de Lotus notes pour les importers dans eGroupware mais il me manque une dernière chose avant de terminer le scenario de migration. Les utilisateurs doivent tous garder une copie de leur email. Hors, je ne trouve aucun moyen d'exporter les mails correctement depuis Lotus.
eGroupware utilise le serveur imap cyrus pour lire les emails.
Lotus Notes est configuré en imap également.
 
Comment pourrais-je procéder pour faire une copie des emails entre les 2 serveurs?

Reply

Marsh Posté le 28-10-2009 à 11:42:50   

Reply

Marsh Posté le 29-10-2009 à 09:21:54    

J'ai trouvé hier un script permettant l'export des emails pour Lotus Notes 6. Cependant, ce script ne fonctionne pas sous Lotus Notes 5.
 

Code :
  1. Option Public
  2. Dim CONVERT_DB_SERVER As String
  3. Dim CONVERT_DB_NAME As String
  4. Dim CONVERT_FORM As String
  5. Dim CONVERT_FIELD As String
  6. Dim CONVERT_TOFIELD As String
  7. Dim OUTFILENAME As String
  8. Dim crlf As String
  9. Dim SaveTempDoc As Integer
  10. Dim fileNum As Integer
  11. Dim doc As NotesDocument
  12. Dim nstream As NotesStream
  13. Dim x As String
  14. Dim count As Integer
  15. Dim b As String
  16. '** ShellExecute will open a file using the registered file association on the computer.
  17. '** If it returns a value of greater than 32 then the call was successful; otherwise
  18. '** it should return one of the error codes below. The parameters are:
  19. '**  hwnd = an active window handle, or 0
  20. '**  operation = "edit", "explore", "find", "open", or "print"
  21. '**  fileName = a file or directory name
  22. '**  parameters = if fileName is an executable file, the command line parameters
  23. '**       to pass when launching the application, or "" if no parameters
  24. '**       are necessary
  25. '**  directory = the default directory to use, or "" if you don't care
  26. '**  displayType = one of the displayType constants listed below
  27. Declare Function ShellExecute Lib "shell32" Alias "ShellExecuteA" _
  28. (Byval hwnd As Long, Byval operation As String, Byval fileName As String, _
  29. Byval parameters As String, Byval directory As String, Byval displayType As Long) As Long
  30. '** FindExecutable will determine the executable file that is set up to open a particular
  31. '** file based on the file associations on this computer. If it returns a value of greater than
  32. '** 32 then the call was successful; otherwise it should return one of the error codes
  33. '** below. The parameters are:
  34. '**  fileName = the full path to the file you are trying to find the association for
  35. '**  directory = the default directory to use, or "" if you don't care
  36. '**  retAssociation = the associated executable will be returned as this parameter,
  37. '**       with a maximum string length of 255 characters (you will want
  38. '**       to pass a String that's 256 characters long and trim the
  39. '**       null-terminated result)
  40. Declare Function FindExecutable Lib "shell32" Alias "FindExecutableA" _
  41. (Byval fileName As String, Byval directory As String, Byval retAssociation As String) As Long
  42. '** constants for the displayType parameter
  43. Const SW_HIDE = 0
  44. Const SW_SHOWNORMAL = 1
  45. Const SW_NORMAL = 1
  46. Const SW_SHOWMINIMIZED = 2
  47. Const SW_SHOWMAXIMIZED = 3
  48. Const SW_MAXIMIZE = 3
  49. Const SW_SHOWNOACTIVATE = 4
  50. Const SW_SHOW = 5
  51. Const SW_MINIMIZE = 6
  52. Const SW_SHOWMINNOACTIVE = 7
  53. Const SW_SHOWNA = 8
  54. Const SW_RESTORE = 9
  55. Const SW_SHOWDEFAULT = 10
  56. Const SW_MAX = 10
  57. '** possible errors returned by ShellExecute
  58. Const ERROR_OUT_OF_MEMORY = 0  'The operating system is out of memory or resources.
  59. Const ERROR_FILE_NOT_FOUND = 2  'The specified file was not found.
  60. Const ERROR_PATH_NOT_FOUND = 3 'The specified path was not found.
  61. Const ERROR_BAD_FORMAT = 11   'The .exe file is invalid (non-Microsoft Win32® .exe or error in .exe image).
  62. Const SE_ERR_FNF = 2       'The specified file was not found.
  63. Const SE_ERR_PNF = 3      'The specified path was not found.
  64. Const SE_ERR_ACCESSDENIED = 5  'The operating system denied access to the specified file.
  65. Const SE_ERR_OOM = 8      'There was not enough memory to complete the operation.
  66. Const SE_ERR_SHARE = 26     'A sharing violation occurred.
  67. Const SE_ERR_ASSOCINCOMPLETE = 27 'The file name association is incomplete or invalid.
  68. Const SE_ERR_DDETIMEOUT = 28   'The DDE transaction could not be completed because the request timed out.
  69. Const SE_ERR_DDEFAIL = 29    'The DDE transaction failed.
  70. Const SE_ERR_DDEBUSY = 30    'The Dynamic Data Exchange (DDE) transaction could not be completed because other DDE transactions were being processed.
  71. Const SE_ERR_NOASSOC = 31    'There is no application associated with the given file name extension. This error will also be returned if you attempt to print a file that is not printable.
  72. Const SE_ERR_DLLNOTFOUND = 32  'The specified dynamic-link library (DLL) was not found.
  73. Declare Function GetActiveWindow Lib "user32.dll" () As Long
  74. ' // BrowseInfo stucture
  75. Type BROWSEINFO
  76. hwndOwner As Long
  77. pidlRoot As Long
  78. pszDisplayName As String
  79. lpszTitle As String
  80. ulFlags As Long
  81. lpfn As Long
  82. lParam As Long
  83. iImage As Long
  84. End Type
  85. ' // BrowseFlags constants
  86. Const BIF_BROWSEFORCOMPUTER = 1000
  87. Const BIF_BROWSEFORPRINTER = 2000
  88. Const BIF_DONTGOBELOWDOMAIN = 2
  89. Const BIF_RETURNFSANCESTORS = 8
  90. Const BIF_RETURNONLYFSDIRS = 1
  91. Const BIF_STATUSTEXT = 4
  92. Const MAX_SIZE = 255
  93. ' // Win32 function to browse for a folder, rather than a file or files
  94. Declare Function BrowseFolderDlg Lib "shell32.dll" Alias "SHBrowseForFolder" (lpBrowseInfo As BROWSEINFO) As Long
  95. ' // Win32 function that returns the path of the folder selected
  96. Declare Function GetPathFromIDList Lib "shell32.dll" Alias "SHGetPathFromIDList" (Byval PointerToIDList As Long, Byval pszPath As String) As Long
  97. Sub Initialize
  98. Dim s As New NotesSession
  99. Dim db As NotesDatabase
  100. Dim dc As NotesDocumentCollection
  101. Dim body As NotesItem
  102. Dim rtitem As NotesRichTextItem
  103. Dim mimebits As Variant
  104. Dim n As Integer
  105. Dim msgid As Variant
  106. crlf = Chr(13) & Chr(10)
  107. 'Dim mime As NotesMIMEEntity, mime2 As NotesMIMEEntity
  108. '** this is a form that has a rich text field that is set to store contents
  109. '** in MIME format
  110. CONVERT_FORM = "MimeConvert"
  111. '** this is the field on the form mentioned above that stores rich text
  112. '** as MIME
  113. CONVERT_TOFIELD="MimeRichTextField"
  114. CONVERT_FIELD = "Body"
  115. '** do you want to save the temporary doc after you're done with it
  116. '** (True) or delete it (False)?
  117. SaveTempDoc = False
  118. expdir$=BrowseForFolder()
  119. If expdir$="" Then
  120.  Messagebox "You have not selected a directory", MB_OK, "Select output Directory"
  121.  Exit Sub
  122. End If
  123. Dim mime As NotesMIMEEntity
  124. Dim subj As String
  125. Set nstream=s.CreateStream
  126. Set db = s.CurrentDatabase
  127. s.ConvertMime = False ' Do not convert MIME to rich text|
  128. Set dc = db.UnprocessedDocuments
  129. Set doc = dc.GetFirstDocument
  130. n=0
  131. While Not(doc Is Nothing)
  132.  n=n+1
  133.  If doc.subject(0) ="" Then
  134.   subj="No subject"
  135.  Else
  136.   subj=validatefilename(doc.subject(0))
  137.  End If
  138.  OUTFILENAME=expdir$ & "\" & subj & " - " & doc.NoteID & ".eml"
  139.  Set body = doc.GetFirstItem("Body" )
  140.  fileNum% = Freefile
  141.  fileName$ = OUTFILENAME
  142.  Open filename$  For Output As fileNum%
  143.  If body.Type = MIME_PART Then
  144.   Set mime = body.GetMimeEntity
  145.   mimebits=getmultipartmime(mime)
  146.   Print #fileNum%, mimebits
  147.  Else
  148.   Call GetRichTextAsHtmlFile(doc, CONVERT_FIELD, OUTFILENAME, True)
  149.  End If
  150.  Close fileNum%
  151.  'Kill filename$
  152.  Set doc = dc.GetNextDocument(doc)
  153. Wend
  154. fileName$ = "c:\program files\horizon\horizondmsave.exe"
  155. If isfile(fileName$) Then
  156.  result& = ShellExecute(0, "open", fileName$, "DIR=c:\export", "", SW_SHOW)
  157. Else
  158.  Msgbox Cstr(n) & " emails have been exported to " & expdir$
  159. End If
  160. End Sub
  161. Function remsub(substr As String)
  162. Dim mystr As String
  163. For a=1 To Len(substr)
  164.  y=Asc(Mid$(substr,a,1))
  165.  If Not ( y="13" Or y="10" ) Then
  166.   mystr=mystr+Mid$(substr,a,1)
  167.  End If
  168. Next
  169. remsub=mystr
  170. End Function
  171. Function GetBoundary (header As String) As String
  172. '** get the boundary from the initial header of a multi-part MIME string
  173. '** normally, the format in Notes is something like:
  174. '**    Content-Type: multipart/related; boundary="=_related 0012868C85256E16_="
  175. Dim boundary As String
  176. boundary = Strright(header, "boundary=""" )
  177. '** we want everything from the boundary=" to the closing "
  178. If (Instr(boundary, """" ) > 0) Then
  179.  boundary = Strleft(boundary, """" )
  180. End If
  181. If (Len(boundary) > 0) Then
  182.  boundary = "--" & boundary
  183. End If
  184. GetBoundary = boundary
  185. End Function
  186. Function GetMultipartMime (mime As NotesMIMEEntity) As String
  187. '** recursively get all the parts of a multi-part MIME entity
  188. Dim child As NotesMIMEEntity
  189. Dim mText As String
  190. Dim boundary As String
  191. count=count+1
  192. boundary = GetBoundary(mime.Headers)
  193. '** DANGER -- ContentAsText truncates large MIME bodies in R5!!!
  194. '** ND6 seems to be okay...
  195. If mime.ContentType<>"text" Then
  196.  Call mime.encodecontent(1727)
  197.  mText = mText & mime.Headers & crlf & crlf
  198.  mText = mText & mime.ContentAsText & crlf
  199. Else
  200.  mText = mText & mime.Headers & crlf & crlf
  201.  mText = mText & crlf & mime.ContentAsText & crlf
  202. End If
  203. Set child = mime.GetFirstChildEntity
  204. While Not(child Is Nothing)
  205.  mText = mText & boundary & crlf
  206.  mText = mText & GetMultipartMime(child)
  207.  Set child = child.GetNextSibling
  208. Wend
  209. If (Len(boundary) > 0) Then
  210.  mText = mText & boundary & "--" & crlf & crlf
  211. End If
  212. GetMultipartMime = mText
  213. End Function
  214. Function getlist(field As String)
  215. Dim values As Variant
  216. Dim out As String
  217. Dim session As New NotesSession
  218. Dim nam As NotesName
  219. values = doc.GetItemValue( field )
  220. Forall v In values
  221.  c=c+1
  222.  Set nam=session.CreateName(v)
  223.  If c>1 Then
  224.   out = out +"; "+ nam.abbreviated
  225.  Else
  226.   out=nam.abbreviated
  227.  End If
  228. End Forall
  229. getlist=out
  230. End Function
  231. Function WriteHtmlStringToFile (htmlBody As String, _
  232. fileName As String, setFileExtension As Integer, isMultiPart As Integer) As Integer
  233. '** send a NotesStream containing HTML to the specified fileName
  234. '** (if setFileExtension is True, the fileName will automatically have
  235. '** either .htm or .mht appended as the file extension, depending
  236. '** on whether isMultiPart is True (.mht) or False (.htm))
  237. Dim htmlStart As String, htmlEnd As String
  238. '** set our variables, based on isMultiPart and setFileExtension
  239. If Not  isMultiPart Then
  240. '** non-multi-part files need opening and closing HTML
  241.  htmlStart = "<html><body>"
  242.  htmlEnd = "</body></html>"
  243. End If
  244. 'fileName = fileName & ".eml"
  245. '** open the file for output
  246. 'fileNum = Freefile()
  247. 'Open fileName For Output As fileNum
  248. Print #fileNum%,"From: " & getlist("From" )
  249. Print #fileNum%,"To: " & getlist("SendTo" )
  250. Print #fileNum%,"Cc: " & getlist("CopyTo" )
  251. Print #fileNum%, "Bcc: " & getlist("BlindCopyTo" )
  252. Print #fileNum%,"Subject: " & doc.subject(0)
  253. Print #fileNum%, "Date: " & Format(doc.posteddate(0), "dd mmm yyyy  hh:mm:ss" )
  254. msgid=doc.GetItemValue("$MessageID" )
  255. Print #fileNum, "Message-ID: " & msgid(0)
  256. If Not  ismultipart Then Print  #fileNum%, "MIME-Version: 1.0"
  257. If Not  ismultipart Then Print #fileNum%,"Content-Type: multipart/alternative;"
  258. If Not  ismultipart Then Print #fileNum%, Chr(09) & |boundary="| & Cstr(doc.NoteID) & |"|
  259. Print #1, "X-Priority: " & doc.importance(0)
  260. Forall i In doc.Items
  261.  If i.text<>"" Then
  262.   If i.name<>"Body" Then
  263.    Print #1, "X-Notes-Item: " & i.text & "; name=" & i.name
  264.   End If
  265.  End If
  266. End Forall
  267. If Not  ismultipart Then Print #fileNum%, crlf & "--" & Cstr(doc.NoteID)
  268. If Not  ismultipart Then Print #fileNum%,"Content-Type: text/html;"
  269. If Not  ismultipart Then Print #fileNum%, Chr(09) & |charset="iso-8859-1"|
  270. If Not  ismultipart Then Print #fileNum%, "Content-Transfer-Encoding:  quoted-printable" & crlf
  271. If Not ismultipart Then Print #fileNum%, htmlStart
  272. Print #fileNum%, htmlBody
  273. If Not  ismultipart Then Print #fileNum%, htmlEnd & crlf
  274. If Not ismultpart Then Print #fileNum%, crlf & "--" & Cstr(doc.NoteID) & "--"
  275. 'Close #fileNum
  276. WriteHtmlStringToFile = True
  277. Exit Function
  278. processError:
  279. Print "Error " & Err & ": " & Error$
  280. Reset
  281. WriteHtmlStringToFile = False
  282. Exit Function
  283. End Function
  284. Function RefreshDocFields (doc As NotesDocument) As String
  285. '** Refresh the fields on a document, and return the NoteID of
  286. '** the refreshed doc (I don't think this would cause the NoteID
  287. '** to change, but just in case)
  288. On Error Resume Next
  289. '** before we save the uidoc, disable any MIME conversion warnings
  290. '** by setting the MIMEConvertWarning parameter in Notes.ini to 1
  291. Dim session As New NotesSession
  292. Dim oldWarningVal As String
  293. oldWarningVal = session.GetEnvironmentString("MIMEConvertWarning", True)
  294. Call session.SetEnvironmentVar("MIMEConvertWarning", "1", True)
  295. Dim workspace As New NotesUIWorkspace
  296. Dim uidoc As NotesUIDocument
  297. Set uidoc = workspace.EditDocument(True, doc)
  298. Call uidoc.Save
  299. RefreshDocFields = uidoc.Document.NoteID
  300. Call uidoc.Close(True)
  301. %REM
  302. '** if you're not running this on a Notes client, you could
  303. '** try to run this in the background by doing everything
  304. '** using the Notes COM objects, although this is totally
  305. '** unsupported and probably riddled with memory leaks
  306. '** if you could actually get it working (plus, it would only
  307. '** work on a Windows server...)
  308. Dim oleSession As Variant
  309. Dim oleDb As Variant
  310. Dim oleDoc As Variant
  311. Dim oleWorkspace As Variant
  312. Dim oleUidoc As Variant
  313. '** first we have to get a handle to the doc as an OLE object
  314. Set oleSession = CreateObject("Notes.NotesSession" )
  315. Call oleSession.Initialize
  316. Set oleDb = oleSession.GetDatabase("", doc.ParentDatabase.FilePath)
  317. Set oleDoc = oleDb.GetDocumentByID(doc.NoteID)
  318. '** if we were able to do that, we can open and save it as a UIDoc
  319. '** using COM
  320. If Not (oleDoc Is Nothing) Then
  321.  Set oleWorkspace = CreateObject("Notes.NotesUIWorkspace" )
  322.  Set oleUidoc = oleWorkspace.EditDocument(True, oleDoc)
  323.  Call oleUidoc.Save
  324.  RefreshDocFields = oleUidoc.Document.NoteID
  325.  Call oleUidoc.Close(True)
  326. End If
  327. %END REM
  328. '** reset the MIMEConvertWarning Notes.ini variable and return
  329. Call session.SetEnvironmentVar("MIMEConvertWarning", oldWarningVal, True)
  330. End Function
  331. Function GetRichTextAsHtmlFile (doc As NotesDocument, _
  332. fieldName As String, fileName As String, setFileExtension As Integer) As Integer
  333. '** convert a rich text field to HTML, and send it to the specified file
  334. '** (if setFileExtension is True, the fileName will automatically have
  335. '** either .htm or .mht appended as the file extension, depending
  336. '** on whether the HTML representation is multi-part or not)
  337. Dim isMultiPart As Integer
  338. Dim htmlBody As String
  339. htmlBody = GetRichTextAsHtmlString(doc, fieldName, isMultiPart)
  340. GetRichTextAsHtmlFile = WriteHtmlStringToFile(htmlBody, fileName, True, isMultiPart)
  341. End Function
  342. Function GetRichTextAsHtmlString (doc As NotesDocument, _
  343. fieldName As String, isMultiPart As Integer) As String
  344. '** get the contents of the given field as HTML by copying them
  345. '** to a MIME rich text field and reading the MIME field
  346. Dim session As New NotesSession
  347. Dim mText As String
  348. Dim db As NotesDatabase
  349. Dim newDoc As NotesDocument
  350. Dim noteID As String
  351. Dim currentSessionMimeSetting As Integer
  352. Dim rtitem As NotesRichTextItem
  353. Dim rtitem2 As NotesRichTextItem
  354. Dim mimeItem As NotesItem
  355. Dim mime As NotesMIMEEntity
  356. Dim MimeFieldName As String
  357. '** make sure we can actually get the rich text field we want to
  358. '** copy, and make sure it's really rich text (error 13 if it's not)
  359. On Error 13 Resume Next
  360. Set rtitem = doc.GetFirstItem(fieldName)
  361. If (rtitem Is Nothing) Then
  362.  Exit Function
  363. End If
  364. '** save the current ConvertMime setting, because we'll change it
  365. '** a couple of times
  366. currentSessionMimeSetting = session.ConvertMime
  367. '** initially set the ConvertMime property to True and create a
  368. '** temporary document, which allows us to treat the MIME field
  369. '** as rich text so we can append some real rich text to it
  370. session.ConvertMime = True
  371. '** create a new document to manipulate the MIME entry with.
  372. Set db =session.CurrentDatabase
  373. 'Set db = session.GetDatabase(CONVERT_DB_SERVER, CONVERT_DB_NAME)
  374. Set newDoc = New NotesDocument(db)
  375. '** this document must use a form that already exists in this
  376. '** database, and the MIME field that we create must be the
  377. '** same name as a field that's already on the form as a rich text
  378. '** field that stores its data in MIME format
  379. newDoc.Form = CONVERT_FORM
  380. MimeFieldName = CONVERT_TOFIELD
  381. Set rtitem2 = New NotesRichTextItem(newDoc, MimeFieldName)
  382. Call rtitem2.AppendRTItem(rtitem)
  383. Call newDoc.Save(True, True)
  384. '** HERE'S THE TRICK: you have to open the temporary doc
  385. '** as a uidoc, and then save and close it.
  386. '** This will convert all the rich text in our MIME field back to
  387. '** MIME format (which is why the field had to exist as a valid
  388. '** MIME field on a valid form in the first place, so Notes will
  389. '** know to convert it back)
  390. noteID = RefreshDocFields(newDoc)
  391. '** after you've done this, you need to reset the reference for
  392. '** the newDoc variable, so none of the in-memory information
  393. '** about the document will remain
  394. Set newDoc = Nothing
  395. '** set ConvertMime to False, reopen the temporary doc,
  396. '** and now we can get the rich text contents as HTML
  397. session.ConvertMime = False
  398. Set newDoc = db.GetDocumentByID(noteID)
  399. Set mimeItem = newDoc.GetFirstItem(MimeFieldName)
  400. If Not (mimeItem Is Nothing) Then
  401.  If (mimeItem.Type = MIME_PART) Then
  402.   Set mime = mimeItem.GetMimeEntity
  403.   If Not (mime Is Nothing) Then
  404.    If (mime.ContentType = "multipart" ) Then
  405.     '** for multi-part MIME, which is anything with graphics,
  406.     '** you need to get the various parts one at a time.
  407.     '** If you write this to a file, it should be a .mht file so the
  408.     '** the browser knows what to do with it.
  409.     '** NOTE: there is a bug in R5 where you can't always
  410.     '** get the full contents of large sections of multi-part
  411.     '** MIME -- if you're dealing with large images, they will
  412.     '** often get cropped off at the bottom
  413.     isMultipart = True
  414.     mText = GetMultipartMime(mime)
  415.    Else
  416.     '** if we're not dealing with multi-part (thank goodness)
  417.     '** we can just grab the HTML contents and go
  418.     isMultipart = False
  419.     mText = mText & mime.ContentAsText
  420.    End If
  421.   End If
  422.  End If
  423. End If
  424. '** delete or save the temporary doc when we're done (depending on
  425. '** the SaveTempDoc setting)
  426. If SaveTempDoc Then
  427.  Set rtitem2 = New NotesRichTextItem(newDoc, "HTMLText" )
  428.  Call rtitem2.AppendText(mText)
  429.  Call newDoc.Save(True, True)
  430. Else
  431.  Call newDoc.Remove(True)
  432. End If
  433. '** set the ConvertMIME setting back to whatever it was
  434. '** before we started all this, and exit out
  435. session.ConvertMIME = currentSessionMimeSetting
  436. GetRichTextAsHtmlString = mText
  437. End Function
  438. Function validatefilename(filename As String)
  439. Dim l As Integer
  440. Dim x As Integer
  441. Dim newname As String
  442. l=Len(filename)
  443. For x = 1 To l
  444.  If Mid$(filename,x,1) Like "[-@()~^$#[{}=A-Za-z0-9]" Then
  445.   newname=newname+Mid$(filename,x,1)
  446.  Else
  447.   If Mid$(filename,x,1)=" " Or Mid$(filename,x,1)="]" Or Mid$(filename,x,1)=","  Or Mid$(filename,x,1)="'"  Or Mid$(filename,x,1)="!" Then
  448.    newname=newname+Mid$(filename,x,1)
  449.   Else
  450.    Print Mid$(filename,x,1) " is not valid"
  451.   End If
  452.  End If
  453. Next x
  454. validatefilename=newname
  455. End Function
  456. Function isFolder(Byval sFolderPath As String) As Integer
  457. Const ATTR_DIRECTORY = 16
  458. isFolder = False
  459. If Dir$(sFolderPath, ATTR_DIRECTORY) <> "" Then isFolder = True
  460. End Function
  461. Function isFile(Byval sFileName As String) As Integer
  462. On Error Resume Next
  463. Dim lFileLength As Long
  464. Const ATTR_NORMAL = 0
  465. isFile = False
  466. If Dir$(sFileName, ATTR_NORMAL) <> "" Then
  467.  lFileLength = Filelen(sFileName)
  468.  If (lFileLength > 0) Then isFile = True
  469. End If
  470. End Function
  471. Function BrowseForFolder() As String
  472. Dim mBrowseInfo As BROWSEINFO
  473. Dim lngPointerToIDList As Long
  474. Dim lngResult As Long
  475. Dim strPathBuffer As String
  476. Dim strReturnPath As String
  477. Dim vbNullChar As String
  478. vbNullChar = Chr(0)
  479. On Error Goto lblErrs
  480. mBrowseInfo.hwndOwner = GetActiveWindow()
  481. ' // Set the default folder for the dialog box (0 = My Computer,
  482. ' // 5 = My Documents)
  483. mBrowseInfo.pidlRoot = 0
  484. mBrowseInfo.lpszTitle = "Select the folder you wish to use:"
  485. ' // Pointer to a buffer that receives the display name  
  486. ' // of the folder selected by the user
  487. mBrowseInfo.pszDisplayName = String(MAX_SIZE, Chr(0))
  488. ' // Value specifying the types of folders to be listed
  489. ' // in the dialog box as well as other options
  490. mBrowseInfo.ulFlags = BIF_RETURNONLYFSDIRS
  491. ' // Returns a pointer to an item identifier list that
  492. ' // specifies the location of the selected folder relative
  493. ' // to the root of the name space
  494. lngPointerToIDList = BrowseFolderDlg(mBrowseInfo)
  495. If lngPointerToIDList <> 0& Then
  496. ' // Create a buffer
  497.  strPathBuffer = String(MAX_SIZE, Chr(0))
  498. ' // Now get the selected path
  499.  lngResult = GetPathFromIDList(Byval lngPointerToIDList, Byval strPathBuffer)
  500. ' // And return just that
  501.  strReturnPath = Left$(strPathBuffer, Instr(strPathBuffer, vbNullChar) - 1)
  502. End If
  503. BrowseForFolder = strReturnPath
  504. lblEnd:
  505. Exit Function
  506. lblErrs:
  507. Messagebox "Unexpected error: " & Error$ & " (" & Cstr(Err) & " ).", 0, "Error"
  508. Resume lblEnd
  509. End Function


 
Les 2 lignes en rouges (ligne 15 et 149) provoquent des erreurs lors de la sauvegarde de l'agent.
Un spécialiste saurait-il contourner cette erreur due à l'incompatibilité de Lotus Notes 5 ?

Reply

Marsh Posté le 29-10-2009 à 15:34:02    

je répond à coté : si tu as imap activé sur ton Lotus, pourquoi ne pas utiliser un outils du type http://freshmeat.net/projects/imapsync/
Le problème c'est qu'il faut connaitre le mot de passe internet de tes utilisateurs lotus mais tu peux probablement trouver ou faire facilement un script Lotus pour le réinitialiser.

Reply

Marsh Posté le 29-10-2009 à 15:45:41    

Merci bcp, je regarde du coté d'imap sync.
Mon but est de pouvoir copier les emails depuis lotus vers cyrus, peu importe les moyens employés. Imapsync sera sans doute la solution retenue, d'autant plus qu'il doit permettre un synchronisation de masse et non utilisateur par utilisateur (ou en tout cas, ça doit se scipter simplement).
 
Encore merci pour cette astuce :D

Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed