DOMINO 附件拆分

domino 中关于附件的部分确实很伤,noteitem对象中貌似没有关于java文件流的处理,只好采用折中的方法,先拆分,后上传,估计IO够呛。

Sub Initialize
    
    Dim session As New NotesSession
    Dim db As NotesDatabase
    Dim doc As NotesDocument
    Dim dc As NotesDocumentCollection
    Dim rtitem As NotesRichTextItem
    Dim object As NotesEmbeddedObject
    Dim fileCount As Integer    
    Const MAX = 100000
    fileCount = 0
    
    Set db = session.Currentdatabase
    Set dc= db.Unprocesseddocuments()
    Set doc = dc.Getfirstdocument()
 

'''''''''''''''''''''''''''''

If Not attdoc Is Nothing Then 
                    Dim rtitem As NotesRichTextItem
                    Dim obj As NotesEmbeddedObject
                    Dim fileCount As Integer
                    filecount=0
                    tt=Evaluate("@AttachmentNames",attdoc)
                    For j=0 To UBound(tt)
                        Set obj=attdoc.Getattachment(tt(j))
                         If Not obj Is Nothing Then 
                             obj.Extractfile("d:\fw\"+obj.Name)
                         End If
                    Next
                End If

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''


   %REM
       步骤一:    先将选中的文档的附件进行拆分,放入指定位置
   %END REM
    Set rtitem = doc.Getfirstitem("attachement")
    If ( rtitem.Type = RICHTEXT ) Then
        ForAll o In rtitem.EmbeddedObjects
            If ( o.Type = EMBED_ATTACHMENT ) _
            And ( o.FileSize > MAX ) Then
                fileCount = fileCount + 1
                Call o.ExtractFile _
                ( "c:\newfile" & CStr(fileCount) )
                Call doc.Save( True, True )
            End If
        End ForAll
    End If
    
    %REM
        步骤二:新建文档,并上传附件
    %END REM
    Set doc = New NotesDocument( db )
    Set rtitem = New NotesRichTextItem(doc, "attachement" )
    While(fileCount)
        Set object = rtitem.EmbedObject(EMBED_OBJECT, "", "c:\newfile" & CStr(fileCount))
        fileCount = fileCount - 1
    Wend
    doc.Form = "Attachement"
    doc.Subject ="Here's Jim's document, as an embedded object"
    Call doc.Save( True, True )

end sub 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值