Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


LotusScript agent to copy calendar items from one calendar to another

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

Expert Comment

ID: 24172172
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

ID: 24184422

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

4rd4fun earned 0 total points
ID: 24412518
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

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Article by: Rob
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…

580 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