SAS Institute. The Power to Know

SAS(R) 9.2 Publishing Framework: Developer's Guide

Previous Page | Next Page

Viewer Processing

Using the Publish Package Interface to Apply a Viewer

After you create a viewer template for a package, the publisher can apply it when publishing the package to e-mail by using the Publish Package Interface. For the e-mail, channel subscriber, and WebDAV delivery types only, you specify a viewer as a property to the PACKAGE_PUBLISH SAS CALL routine.

You specify the VIEWER_NAME property and assign to it a viewer in the form of either an external filename or a SAS fileref.

For example, the following code shows the application of an HTML viewer to a package that is published to e-mail:

publishType = "TO_EMAIL";
   properties = "VIEWER_NAME";
   viewerFile = "filename:c:\dept\saletemp.html";
   emailAddress = "JohnDoe@alphalite.com";
   Call package_publish(pid, publishType, rc,
      properties, viewerFile, emailAddress);

The following code shows the application of a text viewer to a package that is published to e-mail:

publishType = "TO_EMAIL";
   properties = "TEXT_VIEWER_NAME";
   viewerFile = "filename:c:\dept\saletemp.txt";
   emailAddress = "JohnDoe@alphalite.com";
   Call package_publish(pid, publishType, rc,
      properties, viewerFile, emailAddress);

The following code publishes the package (to which an HTML viewer is applied) to all subscribers of the HR channel. The subject property is specified so that all e-mail subscribers will receive the message with the specified subject.

pubType = "TO_SUBSCRIBERS";
storeInfo =
   "SAS-OMA://alpair02.sys.com:8561";
      viewerFile = "filename:c:\dept\saletemp.html";
      channel = 'HR';
subject = "Weekly HR Updates:";
user = "myUserName";
password = "myPassword";
props = "VIEWER_NAME, SUBJECT, CHANNEL_STORE, METAUSER,
METAPASS";
CALL PACKAGE_PUBLISH(packageId, "TO_SUBSCRIBERS", rc,
   props, viewerFile, subject, storeInfo, user, password,
   channel);

The following code publishes the package (to which an HTML viewer is applied) to a WebDAV-compliant server:

rc = 0;
pubType = "TO_WEBDAV"
subject = "Nightly Maintenance Report"
properties= "VIEWER_NAME, COLLECTION_URL"
viewerFile = "filename:c:\dept\saletemp.html"
cUrl = "http://www.alpair.web/NightlyMaintReport"
CALL PACKAGE_PUBLISH(packageId, pubType,
   rc, properties, viewerFile, cUrl);

For complete details about how to programmatically specify a viewer when you publish to the e-mail and the channel subscriber types, see PACKAGE_PUBLISH CALL routine syntax.

Previous Page | Next Page | Top of Page