Update database design using NotesAPI

xiaoxiao2021-03-06  91

'Declare

DECLARE FUNCTION W32_NSFDBOPEN LIB "nnotes.dll" Alias ​​"nsfdbopen" (Byval DBName As String, HDB As Long) AS INTEGER

DECLARE FUNCTION W32_NSFDBCLOSE LIB "nnotes.dll" alias "nsfdbclose" (Byval HDB As long) AS Integer

Declare function w32_nsfdbinfoget lib "nnotes.dll" alias "nsfdbinfoget" (Byval Dbinfo As String) AS Integer

Declare Sub W32_NSFDBINFOMODIFY LIB "nnotes.dll" alias "nsfdbinfomodify" (ByVal What As String, Byval NewValue AS String)

Declare Function W32_NSFDBINFOSET LIB "nnotes.dll" alias "nsfdbinfoseet" (ByVal Dbinfo As String) AS INTEGER

Declare Function W32_DesignRefresh Lib "Nnotes.dll" Alias ​​"Designrefresh" (Byval Sourceserver AS String, Byval HDB As Long, Byval Null 0 As Long, BYVAL NULL1 AS Long AS Integer

Function DesignReplace (StrtargetServer AS String, StrtEMGETFILE AS STRING, STRSOURSERVER AS STRING, REFRESHNOW AS INTEGER) AS INTEGER

'Strtarget Server Is The Server Where The Database To Get New Desig Resides

'StrtargetFile is The Database

'strsourceserver is the server where the design is refreshed from

'refreshnow = true, Starts Refresh Right Away, Otherwise youll Have to wait for the server or do it manually.

DesignReplace = false

DIM SDB As String

DIM TDB AS STRING

DIM HDB As Long

DIM STRDBINFO As String * 255

DIM STRDBTILE AS STRING * 255

DIM STRDBTEMPLATE AS STRING * 255

DIM RC AS INTEGER

Dim force as integer

'*** Build The Path for Target DataBases.

If stratargetserver = "" ""

TDB $ = strtargetfile

Else

TDB $ = Strtarget Server & "!!" & StrtargetFileEnd IF

'*** Get the DB Info from target database

RC% = W32_NSFDBOPEN (TDB $, HDB &)

IF RC% <> 0 THEN

'Error Opening Target Database

EXIT FUNCTION

END IF

RC% = W32_NSFDBINFOGET (HDB &, STRDBINFO)

IF RC% <> 0 THEN

'Error Retrieving Database Info

EXIT FUNCTION

END IF

Call w32_nsfdbinfomodify (strDbinfo, 3, startemplaten)

RC% = W32_NSFDBINFOSet (HDB &, STRDBINFO)

IF RC% <> 0 THEN

'Error Setting New Design Info

EXIT FUNCTION

END IF

IF refreshnow then

'Initiate Refresh Immedierately ...

RC% = W32_DesignRefresh (strsourceserver, HDB &, 1, 0, 0)

END IF

RC% = W32_NSFDBClose (HDB &)

DesignReplace = TRUE

END FUNCTION

Sub initialize

If DesignReplace ("Project", "Mail / Admin .nsf", "" "," Project ", True)

Print "Sweet!"

END IF

End Sub

转载请注明原文地址:https://www.9cbs.com/read-96006.html

New Post(0)