This invite is working fine, except I’m having trouble capturing the Description field of my web doc and placing it in the Body field of the calendar invite. I keep getting the number 133 placed in this field, instead of the text description. What is wrong with this code? TIA
Sub Initialize
Dim ss As New notessession
Dim db As notesdatabase
Dim item As notesitem
Dim webdoc As NotesDocument
Dim doc As NotesDocument
Dim startdttm As NotesDateTime
Dim enddttm As NotesDateTime
Dim Description As Variant
Dim Exclude(1) As String
Dim rtitem As NotesRichTextItem
Set db = ss.CurrentDatabase
Set doc = New NotesDocument( Db )
Set rtitem = New NotesRichTextItem(Doc, "Body" )
Set webdoc = ss.DocumentContext
doc.form = "Appointment"
doc.AppointmentType = "3"
doc.NoticeType = "I"
doc.Alarms = "1"
doc.Subject = "Session Notification: " & webdoc.Class(0)
doc.Location = webdoc.location(0)
doc.Body = webdoc.Description
doc.Logo = "AcNotesLtr"
Set startdttm = New NotesDateTime(webdoc.date(0) & " " & webdoc.time(0))
Set enddttm = New NotesDateTime(webdoc.enddate(0) & " " & webdoc.endtime(0))
doc.CalendarDateTime = startdttm.LSLocalTime
doc.StartDateTime = startdttm.LSLocalTime
doc.StartDate = startdttm.LSLocalTime
doc.StartTime = startdttm.LSLocalTime
doc.EndDateTime = enddttm.LSLocalTime
doc.EndDate = enddttm.LSLocalTime
doc.EndTime =enddttm.LSLocalTime
'Call rtitem.appendtext("Session Date:" & webdoc.date(0) & " Time: " & webdoc.time(0))
Call rtitem.AppendText(doc.Body)
Exclude(0) = "D"
Exclude(1) = "S"
Set Item = Doc.ReplaceItemValue("$StorageTo", "1")
Set Item = Doc.ReplaceItemValue("$PublicAccess", "1")
Set Item = Doc.ReplaceItemValue("CalendarDateTime", webdoc.date(0))
Set Item = Doc.ReplaceItemValue("ExcludeFromView", Exclude)
Set Item = Doc.ReplaceItemValue("_ViewIcon",133)
Call Item.CopyItemToDocument(Doc,"Body")
doc.tmpDoNotProcess = "1"
Call Doc.ComputeWithForm (True, False)
Doc.Principal = "xxx"
Doc.ReplyTo = "xxx"
Doc.INetFrom = "xxx"
Call doc.Send( False, webdoc.StudentInitials(0))
End Sub
Subject: Try:
Set rtitem = New NotesRichTextItem(Doc, "Body" ) Set webdoc = ss.DocumentContext
…
’ doc.Body = webdoc.Description 'Not needed
…
'Call rtitem.appendtext("Session Date:" & webdoc.date(0) & " Time: " & webdoc.time(0))
Call rtitem.AppendText(webdoc.Description)
Oh yeah and drop this line as well:
Set Item = Doc.ReplaceItemValue("_ViewIcon",133)
’ Call Item.CopyItemToDocument(Doc,“Body”) 'This is where your 133 was coming from
Subject: SOLUTION - Thanks bill!
Thanks Bill for your help! I got it working now with the following code:
Sub Initialize
Dim ss As New notessession
Dim db As notesdatabase
Dim item As notesitem
Dim webdoc As NotesDocument
Dim doc As NotesDocument
Dim startdttm As NotesDateTime
Dim enddttm As NotesDateTime
Dim Description As Variant
Dim Exclude(1) As String
Dim rtitem As NotesRichTextItem
Set db = ss.CurrentDatabase
Set doc = New NotesDocument( Db )
Set rtitem = New NotesRichTextItem(Doc, "Body" )
Set webdoc = ss.DocumentContext
doc.form = "Appointment"
doc.AppointmentType = "3"
doc.NoticeType = "I"
doc.Alarms = "1"
doc.Subject = "Session Notification: " & webdoc.Class(0)
doc.Location = webdoc.location(0)
doc.Logo = "AcNotesLtr"
Set startdttm = New NotesDateTime(webdoc.date(0) & " " & webdoc.time(0))
Set enddttm = New NotesDateTime(webdoc.enddate(0) & " " & webdoc.endtime(0))
doc.CalendarDateTime = startdttm.LSLocalTime
doc.StartDateTime = startdttm.LSLocalTime
doc.StartDate = startdttm.LSLocalTime
doc.StartTime = startdttm.LSLocalTime
doc.EndDateTime = enddttm.LSLocalTime
doc.EndDate = enddttm.LSLocalTime
doc.EndTime =enddttm.LSLocalTime
Call rtitem.AppendText(webdoc.Description)
Exclude(0) = "D"
Exclude(1) = "S"
Set Item = Doc.ReplaceItemValue("$StorageTo", "1")
Set Item = Doc.ReplaceItemValue("$PublicAccess", "1")
Set Item = Doc.ReplaceItemValue("CalendarDateTime", webdoc.date(0))
Set Item = Doc.ReplaceItemValue("ExcludeFromView", Exclude)
Set Item = Doc.ReplaceItemValue("_ViewIcon",133)
doc.tmpDoNotProcess = "1"
Call Doc.ComputeWithForm (True, False)
Doc.Principal = "xxx"
Doc.ReplyTo = "xxx"
Doc.INetFrom = "xxx"
Call doc.Send( False, webdoc.StudentInitials(0))
End Sub
Subject: LotusScript help needed on Invitation
Wesley,
You are resetting the same object (Item) with different values. The 133 value is the last ReplaceItemValue you are calling and appears to be overwriting the previous calls. I would use multiple Item variables and progress an index number with them so you are not overwriting (Set Item1=, Set Item2=, etc.).