SAS Institute. The Power to Know

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

Previous Page | Next Page

Publishing Packages

PACKAGE_PUBLISH (Publish Package to E-mail)



Publishes a package using the e-mail transport
Syntax
Arguments
Details
Default Behavior
Archive Path Properties
Viewer Properties
WebDAV Properties
Examples
Example 1: Using PACKAGE_PUBLISH to Publish to E-mail
Example 2: Using PACKAGE_PUBLISH to Publish to E-mail with the SUBJECT Property
Example 3: Using PACKAGE_PUBLISH to Publish to Two E-mail Addresses with the APPLIED_VIEWER_NAME Property
Example 4: Using PACKAGE_PUBLISH to Publish to E-mail with the ARCHIVE_PATH Property
Example 5: Using PACKAGE_PUBLISH to Publish a Collection URL on a WebDAV-Compliant Server to E-mail
Example 6: Using PACKAGE_PUBLISH to Publish to E-mail Addresses That Are In a Password-Protected SAS Data Set

Syntax

CALL PACKAGE_PUBLISH(packageId, publishType, rc, properties,<propValue1, ...propValueN> , address1<, ...addressN>);

Arguments

packageID

identifies the package that is to be published.

Type: Numeric
Direction: Input
publishType

indicates how to publish the package. To publish the package by using the e-mail transport, specify TO_EMAIL.

Type: Character
Direction: Input
rc

specifies a return code.

Type: Numeric
Direction: Output
properties

identifies a comma-separated list of optional property names. Specify any of the following property names, or specify '' to indicate that no properties are to be applied:

  • ADDRESSLIST_DATASET_LIBNAME

  • ADDRESSLIST_DATASET_MEMNAME

  • ADDRESSLIST_VARIABLE_NAME

  • APPLIED_TEXT_VIEWER_NAME

  • APPLIED_VIEWER_NAME

  • ARCHIVE_NAME

  • ARCHIVE_PATH

  • COLLECTION_URL

  • DATASET_OPTIONS

  • ENCODING

  • FROM

  • FTP_PASSWORD

  • FTP_USER

  • HTTP_PASSWORD

  • HTTP_PROXY_URL

  • HTTP_USER

  • IF_EXISTS

  • PARENT_URL

  • PROCESS_VIEWER

  • REPLYTO

  • SUBJECT

  • TARGET_VIEW_NAME

  • TARGET_VIEW_MIMETYPE

  • TEXT_VIEWER_NAME

  • VIEWER_NAME

For more information about these properties, see Transport Properties.
Type: Character
Direction: Input
propValue1, ...propValueN

specifies a value for each specified property name. The order of the property values must match the order of the property names in the properties parameter.

Type: Character or Numeric
Direction: Input
address1 <, ...addressN>

specifies one or more e-mail addresses to use when publishing the package.

Type: Character
Direction: Input

Details


Default Behavior

When publishing to e-mail, the e-mail message is sent in plain text format by default. Only inserted reference entries are published to e-mail. For details about inserting reference entries, see the INSERT_REF CALL routine.

The package description field precedes the reference value in the e-mail message. All other entries that are inserted into the package are ignored.

To override the default behavior, you can specify the ARCHIVE_PATH, COLLECTION_URL, PARENT_URL, TEXT_VIEWER_NAME, or VIEWER_NAME properties.

Note:    If the mailer is not running in a Windows NT operating environment, then you will be prompted for the mail profile to use when you send the e-mail message. To avoid being prompted, specify the EMAILID and EMAILPW options at SAS invocation. For example:

sas -EMAILID "Microsoft Outlook"

  [cautionend]


Archive Path Properties

If you specify the ARCHIVE_PATH property, then an archive is created and published as an e-mail attachment. All entries that are inserted into the package are published as an archive. If you specify a value for ARCHIVE_PATH, then the created archive is stored at the designated location. To create a temporary archive that is deleted after the package is published, specify an ARCHIVE_PATH value of "" or "tempfile".

If you specify ARCHIVE_PATH as an FTP URL or as an HTTP URL, and need details about archive properties, see PACKAGE_PUBLISH (PublishPackage to Archive).

Note:   In order to create an archive under the z/OS operating environment, the z/OS environment must support UNIX System Services directories.  [cautionend]

If you specify the PROCESS_VIEWER property (with either the VIEWER_NAME or TEXT_VIEWER_NAME property) along with the ARCHIVE_PATH property, then the archive is created but is not sent as an attachment in e-mail. Instead, viewer processing occurs and the rendered view is sent in e-mail.

For more information about the application of viewer properties, see Viewer Processing.

When publishing to an archive with the e-mail transport, you can specify the following archive properties: ARCHIVE_NAME, ARCHIVE_PATH, FTP_PASSWORD, FTP_USER, HTTP_PASSWORD, HTTP_PROXY_URL, or HTTP_USER.


Viewer Properties

If you specify the VIEWER_NAME or TEXT_VIEWER_NAME property, then the viewer is used to create the e-mail message and to apply substitutions. VIEWER_NAME renders the view in HTML format. TEXT_VIEWER_NAME renders the view in text format. Only the package information that is rendered by the viewer is published.

If you specify the PROCESS_VIEWER property (with either the VIEWER_NAME or TEXT_VIEWER_NAME property) along with the ARCHIVE_PATH property, then the archive is created but is not sent as an attachment in e-mail. Instead, viewer processing occurs and the rendered view is sent in e-mail.


WebDAV Properties

If you specify the COLLECTION_URL property, then the package is published to the specified URL on a WebDAV-compliant Web server. An example of a collection URL is http://www.host.com/AlphaliteAirways/revenue/quarter1. The collection is named quarter1. The e-mail message that is sent to subscribers will contain a reference to the URL that is specified in the COLLECTION_URL property.

The PARENT_URL property is similar to the COLLECTION_URL property except that it specifies the location under which the new WebDAV collection is to be placed. The PUBLISH_PACKAGE CALL routine generates a unique name for the new collection. The unique name is limited to eight characters, with the first character as an s. An example of a parent URL directory location is http://www.host.com/AlphaliteAirways/revenue. An example of a collection name that is automatically generated might be s9811239. The e-mail message contains a reference to the collection, which is the URL that you specified in the PARENT_URL property.

The specifications of COLLECTION_URL and PARENT_URL are mutually exclusive.

When publishing to a WebDAV-compliant server with the e-mail transport, you can specify the following WebDAV properties: HTTP_PASSWORD, HTTP_PROXY_URL, HTTP_USER, IF_EXISTS, TARGET_VIEW_MIMETYPE, TARGET_VIEW_NAME, and VIEWER_NAME (or TEXT_VIEWER_NAME).

WebDAV publishing uses the following file extensions for each item type:

File Extensions for Item Types
Item Type File Extension
CATALOG .sac
DATA .sad
FDB .saf
MDDB .sam
REFERENCE .ref
VIEW .sav


Examples


Example 1: Using PACKAGE_PUBLISH to Publish to E-mail

pubType = "TO_EMAIL";
properties='';
CALL PACKAGE_PUBLISH(packageId, pubType, rc, properties,
   "user1@alphaliteairways.com", "John Smith",
   "jsmith@alphaliteairways.com");


Example 2: Using PACKAGE_PUBLISH to Publish to E-mail with the SUBJECT Property

pubType = "TO_EMAIL";
subject = "Nightly Builds Update";
properties="SUBJECT";
Addr = "admins-l@alphaliteair03.vm.com";
CALL PACKAGE_PUBLISH(packageId, pubType,
   rc, properties, subject, Addr);


Example 3: Using PACKAGE_PUBLISH to Publish to Two E-mail Addresses with the APPLIED_VIEWER_NAME Property

The following example publishes a package to two e-mail addresses and designates the viewer to be used when formatting the e-mail message. The e-mail message will contain only content that can be rendered in a view. The rendered view is deleted after it is published.

In order to save the rendered view explicitly, you can specify the APPLIED_VIEWER_NAME property and a filename value.

pubType = "TO_EMAIL";
properties="SUBJECT, VIEWER_NAME";
subject = "Nightly Build Updates";
viewer = "filename:template.html";
Addr = "admins-l@alphaliteair03.vm.com";
CALL PACKAGE_PUBLISH(packageId, pubType,
   rc, properties, subject, viewer,
   "buildmonitor@alphaliteairways.com", Addr);


Example 4: Using PACKAGE_PUBLISH to Publish to E-mail with the ARCHIVE_PATH Property

pubType = "TO_EMAIL";
properties="ARCHIVE_PATH";
apath = "/u/users1";
Addr = "admins-l@alphaliteair05";
CALL PACKAGE_PUBLISH(packageId, pubType,
   rc, properties, apath, Addr);


Example 5: Using PACKAGE_PUBLISH to Publish a Collection URL on a WebDAV-Compliant Server to E-mail

The following example uses the e-mail transport to publish a collection URL on a WebDAV-compliant server. The HTTP user ID and password enable the publisher to bind to the secured HTTP server. All e-mail recipients who are members of the mail list receive the e-mail announcement that the best rates are accessible at the specified URL.

pubType = "TO_EMAIL";
properties="COLLECTION_URL, SUBJECT",
   "HTTP_USER", "HTTP_PASSWORD";
collurl="http://www.alphaliteairways/fares/discount";
subj="Announcing Best Rates Yet";
http_user="vicdamone";
http_password="myway";
Addr = "admins-l@alphaliteair05";
CALL PACKAGE_PUBLISH(packageId, pubType, rc, properties,
   collurl, subj, http_user, http_password, Addr);


Example 6: Using PACKAGE_PUBLISH to Publish to E-mail Addresses That Are In a Password-Protected SAS Data Set

The following example specifies e-mail addresses that are stored in a variable in a password-protected SAS data set.

pubType = "TO_EMAIL";
properties = "SUBJECT, ADDRESS_DATASET_LIBNAME,
   ADDRESS_DATASET_MEMNAME, ADDRESSLIST_VARIABLE_NAME,
   DATASET_OPTIONS";
subject = "Get out and Vote!";
lib = "voterreg";
mem = "northeast";
var = "emailaddr";
opt = "pw='born2run'";
CALL PACKAGE_PUBLISH(packageId, pubType, rc,
   properties, subject, lib, mem, var, opt);

Previous Page | Next Page | Top of Page