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(packageId, 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(packageId, 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.
publishType = "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;
publishType = "TO_WEBDAV";
properties= "VIEWER_NAME, COLLECTION_URL";
viewerFile = "filename:c:\dept\saletemp.html";
cUrl = "http://www.alpair.web/NightlyMaintReport";
CALL PACKAGE_PUBLISH(packageId, publishType,
rc, properties, viewerFile, cUrl);
The following code publishes
the package (to which an HTML viewer is applied) to SharePoint:
rc = 0;
publishType = 'TO_SHAREPOINT';
properties= 'COLLECTION_URL, HTTP_USER, HTTP_PASSWORD, TEXT_VIEWER_NAME,
TARGET_VIEWER_NAME, TARGET_VIEWER_MIMETYPE, APPLIED_TEXT_VIEWER_NAME';
collectionUrl = http://www.alpair.web/NightlyMaintReport;
username = 'user_name';
password = 'password';
viewerFileTemplate = 'FILENAME:C:\dept\saletemp.html';
viewerFileName = 'packageIndex.html';
viewerMimetype = 'application/html';
viewerAppliedOutput = 'FILENAME:C:\dept\saletemp.output.html';
CALL PACKAGE_PUBLISH(packageId, publishType, rc, properties,
collectionUrl, username, password, viewerFileTemplate,
viewerFileName, viewerMimetype, viewerAppliedOutput );