RenderingApplication Object

[Previous] [Next]

The ContainerRenderer object is used to render rows of a container object, such as a folder, as an HTML table. Before you can use a ContainerRenderer, you must set its DataSource property so that it points to the CDO container you want to render.

ContainerRenderer Object Methods

The following section lists the methods of the ContainerRenderer object.

Render Method

The Render method causes the ContainerRenderer object to produce the HTML for the specified data source. This method takes one required parameter and three optional parameters. The required parameter is the style that you the items rendered in. By passing in the value of CdoFolderContents(1), you are specifying that CDO should render the contents of the container. This parameter value is valid only when your DataSource property is an AddressEntries, Messages, or Recipients collection.

If you pass as the parameter a value of CdoFolderHierarchy(2), you are telling CDO to render the hierarchy of the collection, which means that only children folders will be rendered, not the actual contents. This parameter value is valid only when the DataSource property is set to a Folders or a Messages collection.

The first optional parameter is the page number at which to begin rendering. The default for this parameter is 1. CDO automatically breaks up content into pages to improve the performance of applications. The default numbers of items per page is 25. You can modify this default by changing the RowsPerPage property.

The second optional parameter is a Boolean value that is reserved for internal use only. You should always pass 0 for this parameter.

The final optional parameter is the ASP Response object that you want to use to accumulate the HTML output. If you do not specify this object, you can set the Render method to a variable and then modify the HTML that it produces.

The HTML output of this method and the RenderHeading method are two separate tables. The RenderHeading method renders a header row, and the Render method renders the content rows. The TablePrefix and TableSuffix strings are inserted around each of these tables.

The following example shows you how to render the contents of your Inbox by using the Render method:

     Set oContRenderer = oRenderApp.CreateRenderer(3)         oContRenderer.RowsPerPage = 20         lStyle = CdoFolderContents         oContRenderer.DataSource = oSession.Inbox.Messages         oContRenderer.Render lStyle, 1, 0, Response         'This will render the first 20 items in your Inbox  

RenderDate Method

The RenderDate method renders the date portion of a date/time variable. If you need to render the time portion, use the RenderTime method. The RenderDate method takes two required parameters and one optional parameter.

NOTE
If you need to render the time portion, use the RenderTime method.

The first required parameter for RenderDate is the vbDate variable you want to have rendered. The second required parameter is the format picture string you want to use for the date output. The contents you can pass for this parameter are defined in the Microsoft Win32 GetDateFormat function. An example of the format for short dates is <;$QD>M/dd/yy<;$QD>. The date 10/01/98 would be rendered using this format. If you want long dates, you would use "dddd' ',' ' MMMM d' ',' ' yyyy". For example, Wed, October 1, 1998 would is rendered using this format.

The optional parameter for RenderDate method is the Response object you want to send the HTML output to. Normally you would want the standard Response object of the ASP object model.

The following example renders today's date in the short format:

     oContRenderer.RenderDate CDate(Now), "M/dd/yy", Response

RenderHeading Method

The RenderHeading method renders a table containing the current view's column headers. The method takes two optional parameters. The first is the cell pattern, which is a string that specifies how to render the heading cell for each column. This string can hold any standard HTML tags.

The second optional parameter is the Response object to send the HTML output to. Normally, this is the standard ASP Response object.

RenderProperty Method

The RenderProperty method renders the designated property of the parent of the object specified in the DataSource property. This means that if you specified the AddressEntries collection as the data source, the specified property on the AddressList parent will be rendered.

The RenderProperty method takes one required parameter and two optional parameters. The required parameter is either the property tag or the custom name of the property that you want rendered.

The first optional parameter is a Boolean that is reserved for internal use. You should always specify 0 for this parameter. The second optional parameter is the Response object you want to render the output to. This object is usually the standard ASP Response object.

RenderTime Method

The RenderTime method renders the time portion of the supplied variable. This method is very similar to the RenderDate method in that it takes the same parameters. The only difference between the two methods is the second parameter, which specifies the format for the time to be rendered in. For example, to have CDO render 10:52:12 PM, you would specify the format parameter like this: "hh':'mm':'ss tt". The following example renders out the time in military time.

     strFormat = "H'':''mm"     oContRenderer.RenderTime cDate(Now), strFormat, Response

ContainerRenderer Object Properties

The next few sections describe the properties of the ContainerRenderer object.

BusinessDayEndTime Property

The BusinessDayEndTime property returns or sets the time when the business day should end. This property defaults to 5:00 PM if you do not set it. You need to pass to this property a variant, in the vbDate format, to specify when the day should end. The following example shows you how to set this property. The easiest way to do this is to set the property to the value returned by the Session object's GetOption method.

     oContRenderer.BusinessDayEndTime = _         oSession.GetOption("BusinessDayEndTime")

BusinessDays Property

The BusinessDays property returns or sets a bitmask that specifies the days of the week that are considered business days. This property takes or returns a Long that is a logical OR of one or more of the constants used for the RecurrencePattern object's DayOfWeekMask property. This property defaults to 62, which is Monday through Friday. The easiest way to set this property is to use the value returned by the Session object's GetOption method, as shown here:

     oContRenderer.BusinessDays = oSession.GetOption("WorkingDays")

BusinessDayStartTime Property

The BusinessDayStrartTime property returns or sets the time that the business day should start. This property takes a vbDate Variant. The easiest way to set this property is to use the value returned by the Session object's GetOption method, as shown here:

     oContRenderer.BusinessDayStartTime = _         oSession.GetOption("BusinessDayStartTime")

CellPattern Property

The CellPattern property returns or sets the string that specifies how every cell in the table is rendered. This property affects all rows except the heading row. The default setting for this property is <FONT COLOR=000000 SIZE=2>.

CurrentStore Property

This property sets the message store that contains the data source specified in the DataSource property. You need to set this property only when you are rendering items from public folders.

CurrentView Property

The CurrentView property returns or sets the current view to be used when rendering your data source. When retrieving this property, you must use the Set statement with your variable because the property will return a View object. When setting this property, you can either specify a View object, the index, or the name of the view you want to set as the current view. The following example sets the current view to be a named view:

     oContRenderer.CurrentView = "Unread Messages"

DataSource Property

The DataSource property returns or sets the CDO container object to render. Because an address book container does not contain a default view, you are rendering it, you must first define custom views for the container. You must define the custom views before you set the DataSource property to the address book container. The following code example sets the DataSource property on a container renderer to be the messages in your Inbox:

     oContRenderer.DataSource = oSession.Inbox.Messages

FirstDayOfWeek Property

The FirstDayOfWeek property returns or sets the first day that a week should start on. This property defaults to a value of 7, which is Sunday. The values you can set in this property range from 1 for Monday through 7 for Sunday. The easiest way to set this property is to use the value returned by the GetOption method on the CDO Session object, as shown here:

     oContRenderer.FirstDayOfWeek = oSession.GetOption("FirstDayOfWeek")

Formats Property

The Formats property returns a single Format object or a Fomats collection object. If you pass no parameters to this property, you will get a Formats collection. If you pass either a name or an index for a Format object, the Formats collection will return the specified Format object. Note that you must add new Format objects to the Formats collection before you set the DataSource property.

HeadingCellPattern Property

The HeadingCellPattern property returns or sets the string that specifies how to render the heading for each table view column. This string can hold standard HTML tags. The default setting for this property is this:

     s<FONT COLOR=000000 SIZE=2>%value%</FONT>.

HeadingRowPrefix Property

The HeadingRowPrefix property returns or sets the HTML string to insert at the beginning of a heading row. The default setting for this property is this:

     <TR BGCOLOR=CCCC99 VALIGN="TOP">

You can change the HeadingRowPrefix property to modify how the heading row is rendered. For example, you can specify using different colors or fonts.

HeadingRowSuffix Property

The HeadingRowSuffix property returns or sets the HTML string to insert after the heading row. The default setting for this property is </TR>.

Is24HourClock Property

The Is24HourClock property returns or sets whether the calendar should be rendered in 12-hour or 24-hour mode. Set this property to False to render in 12-hour mode; set it to True to render in 24-hour mode. This property defaults to False if not set. The easiest way to set it is to use the return value from the GetOption method on the CDO Session object, as shown here:

     oContRenderer.Is24HourClock = oSession.GetOption("Is24HourClock")

LinkPattern Property

The LinkPattern property returns or sets the HTML string that specifies how a link in a table row is rendered. The CDO library generates a link for exactly one cell in each row. You can use the following substitution tokens with this property: %classpath%, %obj%, %rowid%, or %<formatname>%. The following example shows you how to use LinkPattern:

     bstrLinkPattern = "<A HREF='mylink.asp?obj=%obj%'>%value%</A>"     oContRenderer.LinkPattern = bstrLinkPattern

PrivateStore Property

The property is used to set the InfoStore object that will be used when accessing personal views for a container object. The default store for this property is the InfoStore that contains the user's Inbox folder.

RowPrefix Property

The RowPrefix property sets or returns the HTML string to insert at the beginning of each row. The default value for this property is this:

     <TR BGCOLOR=FFFFFF VALIGN="TOP" ALIGN="LEFT">

If you do change this property, you should always put in the <TR> tag.

RowsPerPage Property

The RowsPerPage property returns or sets the number of rows to render per page. This property defaults to 25 rows. You should modify this property in order to fit the rendered output correctly in its HTML location.

RowSuffix Property

The RowSuffix property returns or sets the HTML string to render at the end of each row. The default setting for this property is </TR>. If you modify this property, always include the </TR> tag.

TablePrefix Property

The TablePrefix property returns or sets the HTML string to insert at the beginning of the output for a folder or an address book container. For a table view, the default value for this property is this:

     <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=1 WIDTH=%tablewidth%>

For a calendar view, the default value is this:

     <TABLE COLUMNS=%columns% BORDER=0 CELLPADDING=0 CELLSPACING=1     WIDTH=100% HEIGHT=100%> 

The %tablewidth% token specifies a fixed value that represents the sum of the widths of all columns in the view. If you modify this property, always include the <TABLE> tag.

TableSuffix Property

The TableSuffix property returns or sets the HTML string to render at the end of a folder or an address book table. The default value for this property is </TABLE>. If you modify this property, include the </TABLE> tag.

TimeZone Property

The TimeZone property sets or returns the time zone in which to render the calendar. The easiest way to set this property is to use the value returned by the GetOption method on the CDO Session object, as shown here:

     oContRenderer.TimeZone = oSession.GetOption("TimeZone")

Views Property

The Views property returns a single CalendarView or TableView object, or a Views collection. If you specify no parameters for this property, you will get the Views collection. If you specify an index for this property, you will get back the View object that corresponds to that index in the collection.



Programming Microsoft Outlook and Microsoft Exchange
Programming Microsoft Outlook and Microsoft Exchange, Second Edition (DV-MPS Programming)
ISBN: 0735610193
EAN: 2147483647
Year: 2000
Pages: 184

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net