Solved

Lotus Notes Calendar button: need to add repeating entries to workable calendar appointment, or simply multiple dates

Posted on 2009-04-06
4
1,727 Views
Last Modified: 2013-11-16
The calendar button worked until I added the following lines of code to attempt to repeat entries:
Can you please help me modify the following to work.  I'll need the user to be able to add the multiple dates to the button code.  Thanks in advance.  this is urgent if you can help.

See Code Snippet for these lines of code - attempting to repeat calendar entry each 3rd wed. by hardcoding dates:

Lines 26-30
' Need help with the next lines (repeatentry and Set repeatinstance)
      '*********CHANGE HERE - Change REPEAT dateS for new calendar entry  - Change this section for calendar entry************ Comment out "Set repeatentry = "1" if no repeats by placing  ' before the line
      repeatentry = "1"    
            'add the repeating days and times here - would like to have repeating days for every 3rd wed. of each month - manually added dates below:
      Set repeatinstance = New NotesDateTime("04/15/2009 10:00:00 AM EDT 05/20/2009 10:00:00 AM EDT 06/17/2009 10:00:00 AM EDT 07/15/2009 10:00:00 AM EDT 08/19/2009 10:00:00 AM EDT 09/16/2009 10:00:00 AM EDT 10/21/2009 10:00:00 AM EDT 11/18/2009 10:00:00 AM EST 12/16/2009 10:00:00 AM EST")
      
lines 75 - 78
' repeat calendar entry start  - this is where I need help - next two line
      cnote.Repeats = "1" = repeatentry
      cnote.RepeatInstanceDates = repeatinstance
      ' repeat calendar entry end
Sub Click(Source As Button)
	
	 ' **Scroll down to the "CHANGE HERE" sections to customize this button.  
	
	Dim session As New NotesSession
	Dim ws As New NotesUIWorkspace
	Dim db As NotesDatabase     
	Dim content As NotesRichTextItem
	Dim note As NotesDocument
	Dim cnote As NotesDocument
	Dim Removedit As String
	Set uidoc = ws.CurrentDocument
	Set note = uidoc.Document
	Set db = note.parentdatabase    
	Set cnote  =  New NotesDocument (db)    
	
'*********CHANGE HERE - Change start date for new calendar entry - Change this section for calendar entry************		
	
	Set date1 = New NotesDateTime("April 15 2009 10:00 AM ET")
	
'*********CHANGE HERE - Change end date for new calendar entry  - Change this section for calendar entry************		
	
	Set date2 = New NotesDateTime("December 16 2009 10:00 AM ET")                     
	
	
	' Need help with the next lines (repeatentry and Set repeatinstance)
	'*********CHANGE HERE - Change REPEAT dateS for new calendar entry  - Change this section for calendar entry************ Comment out "Set repeatentry = "1" if no repeats by placing  ' before the line
	repeatentry = "1"    
		'add the repeating days and times here - would like to have repeating days for every 3rd wed. of each month - manually added dates below:
	Set repeatinstance = New NotesDateTime("04/15/2009 10:00:00 AM EDT 05/20/2009 10:00:00 AM EDT 06/17/2009 10:00:00 AM EDT 07/15/2009 10:00:00 AM EDT 08/19/2009 10:00:00 AM EDT 09/16/2009 10:00:00 AM EDT 10/21/2009 10:00:00 AM EDT 11/18/2009 10:00:00 AM EST 12/16/2009 10:00:00 AM EST")
	
	
'*********CHANGE HERE - subject for  new calendar entry - Change this section for calendar entry************
'*********To add a line break , use "+Chr(10)+" .  
'*********For example: newSubject = "xyz Demo" +Chr(10) + "Speaker: xyz person"  +Chr(10)+ "Location: xyz Bldg." +Chr(10)+ ""	
	
	newSubject = "xyz Demo"
	
'*********CHANGE HERE - description  for  new calendar entry - Change this section for calendar entry************
	
	'cnote.Body = ""	
	
'*********CHANGE HERE - To add additional descriptive text from your memo to the new calendar entry description - Change this section for calendar entry************	
'*********Follow the next 2 steps:
'*********Step 1:  
'*********Uncomment the two lines of code below by removing the single quote preceding the lines of code so that the line of code become black text: 
'*********For example: 
'*********  'Set content = note.GetFirstItem("Body") 
'*********  'Call content.CopyItemToDocument(cnote, "Body") 
'*********Step 2:	
'*********Comment the line above by adding a single quote before the following line of code so the line of code becomes green text. 
'*********For example:	
'*********cnote.Body = ""	
	
	Set content = note.GetFirstItem("Body")
	Call content.CopyItemToDocument(cnote, "Body")
	
	
'**************************** End of Calendar Change Section ***********************	
	
	
'***********(1) *********  Begin Do Not Change Below***********************************************************************************
	
	'Create calendar entry 
	
	cnote.From = note.From
	cnote.Form = "Appointment"
	cnote.AppointmentType = "0"
	Call cnote.ReplaceItemValue("_ViewIcon", 159)
	cnote.CHAIR = session.UserName     
	cnote.StartDateTime = date1.LSLocalTime
	cnote.EndDateTime = date2.LSLocalTime
	cnote.CalendarDateTime = date1.LSLocalTime
	
	' repeat calendar entry start  - this is where I need help - next two line
	cnote.Repeats = "1" = repeatentry
	cnote.RepeatInstanceDates = repeatinstance
	' repeat calendar entry end
	
	cnote.TimeRange = Timevalue(cnote.StartDateTime(0)) & "-" & _
	Timevalue(cnote.EndDateTime(0))
	cnote.ExcludefromView = "D"
	cnote.BookFreetime = ""
	cnote.Subject=newSubject 'displays in calendar entry and when alarm is generated
	Call cnote.AppendItemValue("$BusyName", session.UserName)
	Call cnote.AppendItemValue("$BusyPriority", "1")
	Call cnote.AppendItemValue("$NoPurge", dt2)
	Call cnote.AppendItemValue("$PublicAccess", "1")
	
	Print "An entry for " & newSubject & " has been successfully added to your calendar."
	Msgbox "An entry for " & newSubject & " was succesfully added to your calendar." ,MB_OK+MB_ICONINFORMATION,"Successful"
	
	date1.adjustMinute -30
	cnote.ReplaceItemValue "$AlarmTime", date1
	cnote.ReplaceItemValue "$AlarmOffset", -30
	cnote.ReplaceItemValue "$Alarm", 1
	cnote.ReplaceItemValue "Alarms", "1"
	cnote.save True, True 
	cnote.putInFolder "($Alarms)"
	Print "Calendar entry added."
	
	Print "Sending confirmation note."
	
	Dim maildoc As NotesDocument
	Dim rtitem As NotesRichTextItem
	Set maildoc = New NotesDocument(db)
	maildoc.Form = "Memo"
	Set rtitem = New NotesRichTextItem(maildoc,"Body")     
	
'***********(1) ****************  End Do Not Change Above***********************************************************************************
	
	
'*********CHANGE HERE - Change Subject for the confirmation note ***********			
	maildoc.Subject = "New Meeting Scheduled"
	
'*********CHANGE HERE - Change Send To  for the confirmation note ***********	
'********To send the confirmation note to one person, just update the name 
'	maildoc.SendTo = ""
	
'********To send the confirmation note to multiple people, do the following:    
'*********Comment the code  above by adding a single quote before the line of code so the line of code becomes green text.
'*********For example:	
'*********'maildoc.SendTo = "zzz@us.ibm.com"
'*********Then uncomment the following lines of code below by removing the single quote preceding the lines of code so that the line of code become black text:  
'*********Note:  the X in the SendToList (1 to X) must match the number of recipients 
'*********For example:  
'*********Dim SendToList(1 To 2) As String
'*********SendToList(1) = ""
'*********'SendToList(2) = ""
'*********Call maildoc.ReplaceItemValue("SendTo",SendToList)
	
	' sendtolist should be in fully qualified notes name id format
'	Dim SendToList(1 To 3) As String
'	SendToList(1) = ""
'	SendToList(2) = ""
'	SendToList(3) = "" 
'	Call maildoc.ReplaceItemValue("SendTo",SendToList)
	
	
'*********CHANGE HERE - Change CC for the confirmation note ***********
	maildoc.CopyTo = ""
	
'*********CHANGE HERE - Change BCC for the confirmation note ***********
	maildoc.BlindCopyTo = ""
	
'*********CHANGE HERE - Change Body for the confirmation note ***********
	Call rtitem.AppendText("New Meeting Scheduled")
	
'*********CHANGE HERE - To disable sending the confirmation note add a quote before the following line  so that the text becomes green
	Call maildoc.Send(False)
	
'************************ End of Mail Reply Notification Change Section ***********************	
	Print "Operation complete."
	
End Sub

Open in new window

0
Comment
Question by:KTTKTT
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 

Author Comment

by:KTTKTT
ID: 24080805
Or how do I just set it up to manually enter multiple dates in the code .  Thanks!
0
 
LVL 63

Expert Comment

by:SysExpert
ID: 24088843
making changes in teh calendar is not trivia, and should not be done lightly.

It is used in many locations and templates  and libraries and unless you do thorough testing in a lab environment, you may never know when a bug bites you badly.

Just my $.02

I hope this helps !
0
 

Author Comment

by:KTTKTT
ID: 24088892
Thanks - understood.   We used this code successfully w/out any problems so far.  Need to modify it to add multiple days - can someone help me please.  Thanks.
0
 

Accepted Solution

by:
KTTKTT earned 0 total points
ID: 25188442
Closing this request.   Hopefully someone can benefit from the code I provided - if you expand it to handle repeating entries, please post.  Thx.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Lotus Notes 41 223
DAOS - Backup / Restore 2 200
how to copy mail box rules from one nsf to another 9 193
Unable to get Domino 9  Repeat AllDay Calendar Event via C&S API 2 229
Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
For beginners of Lotus Notes user this is important to know about the types of files and their location supported by IBM Notes. Mostly users are unaware about how many file types are created and what their usages are. This Article is fully dedicated…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

726 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