Notes文档中附件批量导出到本地系统
来源:互联网 发布:最终幻想13 优化 编辑:程序博客网 时间:2024/05/16 07:27
Type BROWSEINFO
hOwner As Long
pidlRoot As Long
pszDisplayName As String
lpszTitle As String
ulFlags As Long
lpfn As Long
lParam As Long
iImage As Long
End Type
Const BIF_RETURNONLYFSDIRS = &H1
Const BIF_DONTGOBELOWDOMAIN = &H2
Const BIF_STATUSTEXT = &H4
Const BIF_RETURNFSANCESTORS = &H8
Const BIF_BROWSEFORCOMPUTER = &H1000
Const BIF_BROWSEFORPRINTER = &H2000
Const MAX_PATH = 260
Declare Function SHGetPathFromIDList Lib "shell32" Alias "SHGetPathFromIDListA"
(ByVal pidl As Long, ByVal pszPath As String) As Long
Declare Function SHBrowseForFolder Lib "shell32" Alias "SHBrowseForFolderA"
(lpBrowseInfo As BROWSEINFO) As Long
Declare Sub CoTaskMemFree Lib "ole32" (ByVal pv As Long)
Declare Function GetDesktopWindow Lib "user32" () As Long
Sub Initialize()
Dim session As New NotesSession
Dim db As NotesDatabase
Dim collection As NotesDocumentCollection
Dim doc As NotesDocument
Dim rtitem As Variant
Dim NotesItem As NotesItem
Dim bi As BROWSEINFO
Dim pidl As Long
Dim path As String
Dim pos As Integer
bi.hOwner = GetDesktopWindow()
bi.pidlRoot = 0&
bi.lpszTitle = "Select directory to save the attachments"
bi.ulFlags = BIF_RETURNONLYFSDIRS
pidl = SHBrowseForFolder(bi)
path = Space$(MAX_PATH)
If SHGetPathFromIDList(ByVal pidl, ByVal path) Then
pos = InStr(path, Chr$(0))
End If
Call CoTaskMemFree(pidl)
Set db = session.CurrentDatabase
Set collection = db.UnprocessedDocuments
Set doc = collection.GetFirstDocument()
While Not(doc Is Nothing)
// 此处假定附件是嵌入在 Body 域当中,当然也可以循环文档所有的域,然后对于富文本域进行处理,提取附件
Set rtitem = doc.GetFirstItem( "Body" )
If ( rtitem.Type = RICHTEXT ) Then
ForAll o In rtitem.EmbeddedObjects
If ( o.Type = EMBED_ATTACHMENT ) Then
Call o.ExtractFile( Left(path, pos - 1) & "\" & o.Name )
End If
End ForAll
End If
Set doc = collection.GetNextDocument(doc)
Wend
End Sub
hOwner As Long
pidlRoot As Long
pszDisplayName As String
lpszTitle As String
ulFlags As Long
lpfn As Long
lParam As Long
iImage As Long
End Type
Const BIF_RETURNONLYFSDIRS = &H1
Const BIF_DONTGOBELOWDOMAIN = &H2
Const BIF_STATUSTEXT = &H4
Const BIF_RETURNFSANCESTORS = &H8
Const BIF_BROWSEFORCOMPUTER = &H1000
Const BIF_BROWSEFORPRINTER = &H2000
Const MAX_PATH = 260
Declare Function SHGetPathFromIDList Lib "shell32" Alias "SHGetPathFromIDListA"
(ByVal pidl As Long, ByVal pszPath As String) As Long
Declare Function SHBrowseForFolder Lib "shell32" Alias "SHBrowseForFolderA"
(lpBrowseInfo As BROWSEINFO) As Long
Declare Sub CoTaskMemFree Lib "ole32" (ByVal pv As Long)
Declare Function GetDesktopWindow Lib "user32" () As Long
Sub Initialize()
Dim session As New NotesSession
Dim db As NotesDatabase
Dim collection As NotesDocumentCollection
Dim doc As NotesDocument
Dim rtitem As Variant
Dim NotesItem As NotesItem
Dim bi As BROWSEINFO
Dim pidl As Long
Dim path As String
Dim pos As Integer
bi.hOwner = GetDesktopWindow()
bi.pidlRoot = 0&
bi.lpszTitle = "Select directory to save the attachments"
bi.ulFlags = BIF_RETURNONLYFSDIRS
pidl = SHBrowseForFolder(bi)
path = Space$(MAX_PATH)
If SHGetPathFromIDList(ByVal pidl, ByVal path) Then
pos = InStr(path, Chr$(0))
End If
Call CoTaskMemFree(pidl)
Set db = session.CurrentDatabase
Set collection = db.UnprocessedDocuments
Set doc = collection.GetFirstDocument()
While Not(doc Is Nothing)
// 此处假定附件是嵌入在 Body 域当中,当然也可以循环文档所有的域,然后对于富文本域进行处理,提取附件
Set rtitem = doc.GetFirstItem( "Body" )
If ( rtitem.Type = RICHTEXT ) Then
ForAll o In rtitem.EmbeddedObjects
If ( o.Type = EMBED_ATTACHMENT ) Then
Call o.ExtractFile( Left(path, pos - 1) & "\" & o.Name )
End If
End ForAll
End If
Set doc = collection.GetNextDocument(doc)
Wend
End Sub
0 0
- Notes文档中附件批量导出到本地系统
- 多个Notes文档中附件批量汇总到一个文档中
- Lotus Notes 数据库中附件的批量导出
- 批量将本地sql导入到服务器mysql数据库中,和将服务器中的sql导出到本地
- 从NOTES视图中导出EXCEL表及word文档
- 从NOTES视图中导出EXCEL表及word文档
- lotus notes库中数据导出到excel中
- 使用ssh远程执行命令批量导出数据库到本地
- FreeMarker模版引擎实现导出world文档到本地
- 邮件导出到本地
- 导出excel到本地
- excell导出到本地
- 【ODPS】本地数据库数据批量上传到ODPS中
- 简单的java附件批量发送系统
- 数据批量导出到excel文件中思路
- 从hdfs批量导出数据到hbase表中
- 批量把lib中的符号导出到文本中
- OutLook的附件自动存到本地
- 5.3 TCP原理
- android.cts.security.SELinuxNeverallowRulesTest --testNeverallowRulesXXX
- unity5 JoyJoystick分析
- Spring源代码解析(收藏)
- GTX1070+WIN10安装UBUNTU16双系统显示ubuntu ESRT header is not in the memory map
- Notes文档中附件批量导出到本地系统
- 使用Terminal创建与进入目录
- ORA-28001: 口令已经失效
- 初学pyse
- 使用mm命令遇到的问题
- Hive自定义函数(UDF、UDAF)
- 自定义View简单折线图
- mq浅析
- 多个Notes文档中附件批量汇总到一个文档中