LotusScript agent to copy calendar items from one calendar to another

Posted on 2009-04-17
Last Modified: 2013-12-18
I need some coding examples of copying calendar items from one calendar to another
Question by:4rd4fun
    LVL 1

    Expert Comment

    Try this.  If it's only particular doc, you will have to modify it as this grabs all of the docs in a particular view based off of a key.  HTH
    Sub Initialize
    	Dim session As New NotesSession
    	Dim db As NotesDatabase
    	Dim db2 As NotesDatabase
    	Dim view As NotesView
    	Dim view2 As NotesView
    	Dim delview As NotesView
    	Dim vc As NotesViewEntryCollection
    	Dim dc As NotesDocumentCollection
    	Dim dc2 As NotesDocumentCollection	
    	Dim doc As NotesDocument
    	Dim doc2 As NotesDocument
    	Dim fndoc As NotesDocument
    	Dim trname As Variant
    	Set db = session.CurrentDatabase
    	Set db2 = New NotesDatabase("Server", "database name")
    	Set view = db.GetView("TR")
    	Set view2 = db2.GetView("(AllDealers)")
    	Set delview = db.GetView("TRFullName")
    	Set vc = delview.AllEntries
    	Call vc.RemoveAll(True)
    	Set doc = view.GetFirstDocument
    ' Grab and loop thru all the documents in the TR view.  Grab the TRNum field from each document and use that as the key to get the document collection in the Registration DB.
    	While Not(doc Is Nothing)
    		Set dc2 = view2.GetAllDocumentsByKey(doc.TRNum, True) 
    		Set doc2 = dc2.GetFirstDocument
    ' Loop thru the document collection
    		While Not(doc2 Is Nothing)	
    			trname = doc2.GetItemValue("FullName")
    ' Set and create the new document		
    			Set fndoc = New NotesDocument(db)
    			fndoc.Form = "TRFullName"
    			fndoc.TRFullName = doc2.FullName
    			Call fndoc.ComputeWithForm(False, False)
    			Call fndoc.Save(False, True)
    			Set doc2 = dc2.GetNextDocument(doc2)
    		Set doc = view.GetNextDocument(doc)
    End Sub

    Open in new window


    Author Comment


    Thanks for the info. just a little confussed on the code. on the set for the db2. i put the server name and database of the calendar that i want to copy to? I don't see a dim for TR, AllDealers, TRFullName, FullName.

    also i don't see a copy or write in the code either.


    Accepted Solution

    I still need help on this issue. need to find a way to just copy 90 days worth of appointments at a time


    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    For Desktop Techs: How to retain a user's Notes configuration data when swapping out the end user's computer. (Assuming that you are not upgrading to a completely different version of Notes client) All you need to do is: 1) install Notes o…
    You’ve got a lotus Domino web server, and you have been told that “leverage browser caching” is a must do. This means that we have to tell the browser everywhere in the web to use cache. In other words, we set (and send) an expiration date in the HT…
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now