domino 如何创建简要表或者profiledocument
function:兼容主表单和只有汉字别名的简要表备份数据代码范例。
%REM
Description: Domino 如何备份简要表 ,如何备份profile
2022-11-22
%END REM
Option Public
Option Declare
Sub Initialize
On Error GoTo er
Dim session As NotesSession
Dim cdb As NotesDatabase
Dim bakDB As NotesDatabase
Dim a As String
Dim i As Integer
Dim x As Integer
Dim l As Long
Dim commandStr As String
Dim onlineUsers As String
Dim usersStr As String
Dim onlineUsersArray As Variant
Dim doc As NotesDocument
Dim newdoc As NotesDocument
Set session = New NotesSession
Set cdb = session.CurrentDatabase
Set bakDB=cdb
Dim aliazCount As Integer
Dim msgString As String
Dim ans As string
ForAll form In cdb.Forms
Dim bieming As String
Dim isprofile As Boolean
isprofile=false
bieming=""
If Not IsEmpty(form.Aliases) Then'get Aliases Name 取别名
bieming=form.Aliases(0)
End If
Set doc = cdb.GetProfileDocument(CStr(form.Name))
Print "doc.Universalid="+doc.Universalid
If doc.Form(0) ="" Then
If bieming<>"" Then
Set doc = cdb.GetProfileDocument(bieming) '取别名
If doc.Form(0) ="" Then
ans=ans+"----不是profile form="+form.Name+ Chr(10)
Else
ans=ans+ "----是 profile 别名 form="+bieming+ Chr(10)
isprofile=true
End If
Else
ans=ans+ "----不是profile form="+form.Name+ Chr(10)
End If
Else
ans=ans+ "----是 profile form="+form.Name+ Chr(10)
isprofile=True
End If
If isprofile Then
'数据备份DB
Set newdoc=bakDB.Createdocument()
newdoc.BEFORE_Form=doc.Form(0)
Call doc.Copyallitems(newdoc,true)
newdoc.Form="databak"
Call newdoc.Save(true, false)
MessageBox " 配置信息备份完成!"+doc.Form(0)
End If
End ForAll
'MessageBox ans
Exit Sub
er:
MessageBox Error()+" at line:" +Cstr(Erl())+",err"
End Sub
测试:
假设NSF 有多个表单,但是只有三种profiledocument,则只会备份其中的英文profile