Tip

Mail "todo" list

Because the Description field on the ToDo form is Rich Text, it cannot be displayed in a view. One of our salesmen wanted to be able to print the view to show his supervisor his plans for the week. I wrote this agent to read the default Todo View, and send the user the email with a list of the documents including the description field. I placed the agent in the Actions menu so anyone could run it from our Contacts DB.
Sub Initialize
	
	'Get session to get user
	Dim session As New NotesSession
	Dim user As String
	user = session.CommonUserName
	
	'Get the user's information
	Dim reg As New NotesRegistration
	reg.RegistrationServer = "Server00"  'Your server name
	Call reg.GetUserInfo( user, retmailserver$,retmailfile$, retmaildomain$, retmailsystem%, retprofile$)
	
	'Continue with user information
	Dim db As New notesdatabase(retmailserver$, retmailfile$)
	Dim col As notesview
	Set col = db.getview("($ToDo)")
	Dim doc As notesdocument
	Set doc = col.getfirstdocument()
	Dim mailsubject As String
	Dim mailBody As Variant
	Dim count As Integer
	Dim mybody As String
	Set doc = col.getfirstdocument()
	Do While Not (doc Is Nothing)
		mailsubject = doc.subject(0)
		Set mailbody = doc.GetFirstItem( "Body" )
		If ( mailbody.Type = RICHTEXT ) Then
			plainText = mailbody.GetFormattedText( False, 0 )
		End If
		Set item = doc.GetFirstItem( "calendardatetime" )
		Set mailentry = item.DateTimeValue
		Count = Count +1
		mybody = mybody  & Cstr(Count) & "." &  "Entered: " &Mailentry.dateonly & " - " & mailsubject &":  " & plaintext  & Chr(10) & Chr(13)
		Set doc = col.getnextdocument(doc)
	Loop
	
	Set doc = New notesdocument(db)
	doc.sendto = user
	'doc.copyto = "Bosses Name"  'You can use this line or disregard.
	Dim datestring As String
	datestring = Cstr(Today)
	doc.subject = "Todo list as of: " & datestring
	doc.form = "Memo"
	doc.body = mybody
	Call doc.send(False)
End Sub

This was first published in July 2001

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.