Copying documents to other DB without changing the it's UNID

hi all,

aside from using the "copy to database" in a simple action agent to copy document to other database, is there any other way to do so without changing the document's UNID?

regards  
LVL 14
cezarFAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
HemanthaKumarConnect With a Mentor Commented:
And here is the code for the agent.

Sub Initialize
     Dim s As New NotesSession
     Dim db, tdb As NotesDatabase
     Dim coll As NotesDocumentCollection
     Dim doc, cDoc As NotesDocument
     Set db = s.CurrentDatabase
     Server = db.Server   'target server
     FilePath = "**********target Database Path********"
     Set tdb = New NotesDatabase(Server,FilePath)     ' TargetDatabase
     Set coll = db.UnprocessedDocuments
     Set doc = coll.GetFirstDocument
     While Not doc Is Nothing
          Gosub CopyToTargetDB
          Set doc = coll.GetNextDocument(doc)
     Wend
     Exit Sub
CopyToTargetDB:
     Set cDoc = tdb.CreateDocument
     Call doc.CopyAllItems(cDoc)
     cDoc.UniversalID = doc.UniversalID
     Call cDoc.Save(True,False)
     Return
End Sub
0
 
ArunkumarCommented:
Making a replica copy and replicating the documents too would give you the same result.

Copy to Database is the best option for selected documents.  It not only preserves the document UNID but also the created date.

The feature that you can misuse !!! haa haa haa !!!

Have Fun!
Arun.

0
 
HemanthaKumarCommented:
You can do it by using lotus script too !
Do you want the code for it ?

~Hemanth
0
 
cezarFAuthor Commented:
Thanks Arun!

HemanthaKumar,

Really!? I thought UniversalID is a read-only property. I'll give it a try and get back to you as soon as i can.

regards!
0
All Courses

From novice to tech pro — start learning today.