`
liuyp2003
  • 浏览: 54587 次
  • 性别: Icon_minigender_1
  • 来自: 广州
最近访客 更多访客>>
社区版块
存档分类
最新评论

domino lotus 中关于附件(存、取、删)

阅读更多
在逛论坛的时候发现的,看到写的不错,故而摘抄了下来。希望大家共同努力!
注意:这个方法是将附件放到富文本中,然后再将富文本当做存储的介质,进行存取删的操作
取附件方法------------------------------------------
通过Notesdocument.EmabledObjects属性取得
  Dim db As NotesDatabase
  Dim view As NotesView
  Dim doc As NotesDocument
  Set db = New NotesDatabase( "SanFrancisco", "hill.nsf" )
  Set view = db.GetView( "All Documents" )
  Set doc = view.GetLastDocument
  If doc.HasEmbedded Then
    Forall o In doc.EmbeddedObjects
      Messagebox( o.Name )
    End Forall
  Else
    Messagebox "No embedded objects found"
  End If


拆离方法-------------------
可以用NotesEmbeddedObject这个对象的ExtractFile方法
Dim doc As NotesDocument
Dim rtitem As Variant
Dim fileCount As Integer
Const MAX = 100000
fileCount = 0    
'...set value of doc...
Set rtitem = doc.GetFirstItem( "Body" )
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:\reports\newfile" & Cstr(fileCount) )
      Call o.Remove
      Call doc.Save( True, True )
    End If
  End Forall
End If


再次上传附件方法-------
可使用Notesrichtextitem的EmbedObject方法上传
Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim rtitem As NotesRichTextItem
Dim object As NotesEmbeddedObject
Set db = session.CurrentDatabase
Set doc = New NotesDocument( db )
Set rtitem = New NotesRichTextItem( doc, "Body" )
Set object = rtitem.EmbedObject _
( EMBED_ATTACHMENT, "", "c:\jim.sam")
doc.Form = "Main Topic"
doc.Subject = "Here's Jim's document, as an attachment"
Call doc.Save( True, True )
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics