惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

GbyAI
GbyAI
J
Java Code Geeks
雷峰网
雷峰网
WordPress大学
WordPress大学
宝玉的分享
宝玉的分享
云风的 BLOG
云风的 BLOG
V
Visual Studio Blog
V
Vulnerabilities – Threatpost
S
Securelist
The Hacker News
The Hacker News
The Register - Security
The Register - Security
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Help Net Security
Help Net Security
G
Google Developers Blog
Hugging Face - Blog
Hugging Face - Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
M
MIT News - Artificial intelligence
AI
AI
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
The GitHub Blog
The GitHub Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Schneier on Security
Schneier on Security
N
Netflix TechBlog - Medium
T
The Blog of Author Tim Ferriss
Google DeepMind News
Google DeepMind News
Hacker News - Newest:
Hacker News - Newest: "LLM"
H
Hacker News: Front Page
博客园 - 司徒正美
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
B
Blog
Microsoft Azure Blog
Microsoft Azure Blog
大猫的无限游戏
大猫的无限游戏
Security Latest
Security Latest
Engineering at Meta
Engineering at Meta
N
News and Events Feed by Topic
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
酷 壳 – CoolShell
酷 壳 – CoolShell
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
T
Threat Research - Cisco Blogs
U
Unit 42
V
V2EX
V2EX - 技术
V2EX - 技术
L
LINUX DO - 最新话题
aimingoo的专栏
aimingoo的专栏
Microsoft Security Blog
Microsoft Security Blog
Recorded Future
Recorded Future
P
Privacy & Cybersecurity Law Blog
美团技术团队
小众软件
小众软件
F
Fortinet All Blogs

博客园 - helloxuxu

简介DOMINO内置域和CGI变量 Domino系统中B/S下附件链接的处理方法 如何在Domino中使用文本文件注册用户 IBM Lotus Notes/Domino技术知识文档汇总 (2008) NOTES.INI 設定 给Domino系统管理员的十二项建议 用代码设置Excel单元格的格式 - helloxuxu - 博客园 给Domino系统管理员的十二项建议 Javascript中没有自带的将字符转换成日期型的函数 ABAP 函数 WebSphere Application Server v6中的问题诊断以及日志策略 如何在Web上執行不同欄位類型的欄位驗證? Lotus Notes常见问题答疑 谈谈Visual Basic应用程序的几种打印方法 DB1访问DB2 在VB6中导出EXCEL,FOXPRO,PRODOX格式的表 查询 SAP ABAP程序优化方法(搜集自论坛) 用 LotusScript 实现 Excel 报表的自动生成和操作
如何将A文档的附件拷贝的B文档中
helloxuxu · 2007-05-16 · via 博客园 - helloxuxu

请教,如何将A文档的附件拷贝的B文档中?

具体需求如下:

A文档是一个已经存在的文档,另外一个表单中用到上传控件,想在提交的时候本省不保存,而直接把上传的附件保存到A文档中。

注:这样做的目的是为了多人可同时上传,并且避免复制冲突。本人已知的方法是 得到 NotesEmbeddedObject 对象后 使用 ExtractFile 将附件放到服务器物理路径上,之后用NotesRichTextItem对象的EmbedObjec方法将服务器物理路径上的附件在加到Rtf域中。但次方法不好,是否用办法可以直接复制附件,请高手指教!万分感谢!

自己找到答案了,好像没有别的办法,只有先拆分到服务器再加入rtf域。好麻烦

Sub Initialize
   Dim s As New notesSession
    Dim doc As notesDocument
   Set doc = s.documentContext
   Call WebMoveAttachment(Doc, "<Your Rich Text Field Name>")
End Sub
 
函数如下:
 
Function WebMoveAttachment(doc As notesDocument, Byval moveToFieldName As String)
   ' This function moves a file attached via the Web with the File Upload Control to a rich text field.
   Dim s As New notesSession
   Dim tempDir As String
   Dim v2FileNames As Variant
   Dim i As Integer
   Dim attachedFile As notesEmbeddedObject
   Dim filePath As String
    Dim rtItem As notesRichTextItem
   
   tempDir = s.getEnvironmentString("Directory", True)
   ' Put a trailing slash at the end of the directory if it is needed
   If Instr(tempDir, "/") <> 0 And Right(tempDir, 1) <> "/" Then tempDir = tempDir & "/"
   If Instr(tempDir, "\") <> 0 And Right(tempDir, 1) <> "\" Then tempDir = tempDir & "\"
   ' Get the names of all the attachments (1 or more)
   v2FileNames = Evaluate("@AttachmentNames", doc)
   For i = Lbound(v2FileNames) To Ubound(v2FileNames)
      If v2FileNames(i) <> "" Then   ' Make sure it's a valid file name
         Set attachedFile = doc.getAttachment(v2FileNames(i))
         filePath = tempDir & v2FileNames(i)
         ' Save the file on the server
         Call attachedFile.extractFile(filePath)
         ' Create the rich text item and re-attach the file
         If doc.hasItem(moveToFieldName) Then
            Set rtItem = doc.getFirstItem(moveToFieldName)
            ' Add a couple of lines to the rich text field before re-attaching the file
             Call rtItem.addNewLine(2)
         Else
            Set rtItem = New notesRichTextItem(doc, moveToFieldName)
         End If
         Call rtItem.embedObject(1454, "", filePath)
         ' Delete the file(s) from the server file system
         Kill filePath
       End If
   Next   ' Move on to the next file name
End Function

运行本函数需要充许执行无限制的代理