A newsletter is a special type of document, which contains information regarding other documents. You can include one or more documents in a newsletter. The newsletter documents contain only summary information about the documents that constitute the newsletter. This summary can be presented in two ways, as a snapshot of the document in picture format or as document links to the documents that form the newsletter itself. An example of a newsletter is notifying end users about new documents, which match their interest profiles, in a discussion database.
You can implement the newsletter feature using two approaches. One approach is by creating an agent using simple actions; the other is to use a program for this implementation. In the programming approach, you can use either LotusScript or Java. There are no features available in formula language for this.
While it is easy to set up an agent, which uses simple actions to implement the newsletter, it imposes certain limitations. It does not offer you the flexibility to handle complex tasks, such as creating newsletters based on interest profiles of end users.
You can use the Newsletter class for the implementation using LotusScript or Java. The methods and properties available for the class are the same in both LotusScript and Java, except for their naming conventions. In the current context, LotusScript is used. The methodology remains the same when you use Java. In Java, you will need to replace the names with their Java counterparts.
Newsletters are created from a collection of documents. The document collection is usually obtained by conducting a search in the database based on certain matching criteria. You can also create the document collection using other means as well.
There are three steps involved in implementing a newsletter feature program- matically:
-
Create the Newsletter object.
-
Format the content.
-
Send the newsletter to its target audience.
Creating the Newsletter Object
You can create the Newsletter object in two ways. The first is by using the CreateNewsletter method of the NotesSession class. The second is by using the New method. In Java, you cannot use the New method because it is implemented as an interface. For both these ways, you first need to obtain a NotesDocument Collection object (a collection of NotesDocument objects), which has to be passed as an argument when creating the Newsletter object.
You can obtain the NotesDocumentCollection object by using the FTSearch or Search methods of NotesDatabase class. This approach is well suited while implementing the newsletter features by using agents that will run on the server based on a schedule. You can use the UnprocessedDocuments property of the NotesDatabase class to create a newsletter from user-selected documents in a view.
Formatting the Newsletter
After creating the Newsletter object, the next step is formatting the presentation of content in the newsletter. The Newsletter class has two methods and three properties:
-
FormatDocument. This method renders the picture of the specified document in the newsletter's document collection. This is useful if you want to include very few documents in the newsletter. It is also helpful in cases where end users cannot access the database that contains the documents that are sent in the newsletter.
-
FormatMsgWithDocLinks. This method creates links of all the documents in the NotesDocumentCollection object specified when creating the Newsletter object. These two properties control the formatting features. This method is ideal when you have large number documents to be included in the newsletter. It is imperative for end users to be able to access the database that contains the documents.
-
DoSubject. This property controls the inclusion of a string describing the subject for each document. This property works in conjunction with the SubjectItemName property. It will not have any effect if you have not specified the SubjectItemName property.
-
SubjectItemName. This property allows you to map any one field in the documents of the NotesDocumentCollection object as the subject. If the DoSubject property is not set, this property will not have any effect.
-
DoScore. This property specifies whether to include the relevance score of each document in the newsletter. It works only if the NotesDocument Collection object used for creating the Newsletter object is sorted.
Set these three properties before calling the FormatMsgWithDocLinks method. These properties will not have any effect if the FormatDocument method is used to create the newsletter.
Sending the Newsletter
Both the methods FormatMsgWithDocLinks and FormatDocument return a NotesDocument object. You can use the Send method of the NotesDocument class to send the newsletter. You have to specify the form to be used when displaying the newsletter. If you use any special form to format the newsletter, make sure you attach it while using the Send method. Alternatively, you can set the form to memo, which is the default form for mail messages.
|