Programmer's Guide:
Using eRoom Stationery (Item Creation Buttons)

In the eRoom user interface, an Item creation button is a button defined on a Folder Page that allows you to identify a particular eRoom object that acts as a template for reuse. When you create an item creation button, you give it a name and associate it with an existing Principal Item in the same eRoom. To use an item creation button, the user just clicks on it, which causes the template object to be copied into the current Folder Page and then edited.

Stationery Managers and Stationery


SAAPI exposes eRoom's item creation button features using the concepts of stationery managers and stationery objects. A stationery manager is an object where item creation buttons can be defined [in version 4.0, the only object meeting this criteria is the Folder Page object]. Objects which can act as stationery managers implement the IERUStationeryManager interface. Stationery managers manage an ordered collection of Stationery objects, which are the SAAPI equivalent of item creation buttons in the eRoom user interface. Stationery objects, which implement IERUStationery, store a name (the name that appears on the item creation button), and a reference to an associated Principal Item.

Stationery objects are ordered by indices, with a beginning index value of 1. In the eRoom user interface, the item creation buttons corresponding to the Stationery objects will appear from left to right in the same order as the indices of the Stationery objects in the collection.

Operations on Stationery objects, such as creating, deleting, modifying or reordering them, are not applied until you call the Update method in IERUStationeryManager. To abort changes in progress, use the Revert method. To remove all Stationery objects in a collection, use the Clear method.

Creating and Deleting Stationery Objects


To create a Stationery object, first get the IERUStationeryManager interface for a Folder Page object. Then call the CreateStationery method. When you create a Stationery object, you must supply the index of the position it should occupy in the collection. If you specify the index of an existing Stationery object, the new Stationery object will get the index you specify, and the Stationery object previously at that position, and all Stationery objects to its right, will get pushed to the right. Supplying an index value of 0 for this method has the special meaning "insert after the last existing Stationery object".

Dim ExpenseFolder as IERUFolder
Dim StationeryMgr as IERUStationeryManager
Dim NewStationery as IERUStationery
Dim BlankReport as IERUItem

Set ExpenseFolder = MyRoom.GetItemByPath("/Expense Reports/New Reports");
Set BlankReport = MyRoom.GetItemByPath("/Document Templates/Blank Expense Report.xls")
Set StationeryMgr = ExpenseFolder

' Insert a new Stationery object in the first position
Set NewStationery = RoutingSource.CreateRoutingTarget(1, "New Expense Report", BlankReport)
StationeryMgr.Update

To delete one or more Stationery objects, call the Delete method in IERURoutingTarget for each Stationery object object, then call Update on the Routing Source.

' Delete the first Stationery object on the page
RoutingSource.RoutingTargets(1).Delete
RoutingSource.Update

Enumerating, Modifying and Reordering Stationery objects


To enumerate the collection of Stationery objects for a Routing Source, access the Stationery property of IERUStationeryManager.

Dim Target as IERUStationery
For Each Stationery in MyFolder.StationeryMgr.Stationery
' Do something
Debug.Print Stationery.Name & " is associated with " _
  & Stationery.Source.PrincipalItem.Path
Next

To modify the name or source item of a Stationery object, use the Name or Source properties.

Set Stationery = StationeryMgr.Stationery(1)
Stationery.Name = "New Purchase Order"
Stationery.Source = BlankPurchaseOrder
StationeryMgr.Update

To reorder existing Stationery objects, use the SetStationeryPosition method, specifying the Stationery object and the new position to give it. The specified Stationery object is repositioned according to the same rules as CreateStationery.

' Swap the first and second Stationery objects
StationeryMgr.SetStationeryPosition(StationeryMgr.Stationery(2), 1)
StationeryMgr.Update