PACKAGE_PUBLISH (Publish Package to Microsoft SharePoint)

Publishes a package to SharePoint

Syntax

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

Required Arguments

packageID
identifies the package that is to be published.
Type:Numeric, Input
publishType
indicates how to publish the package. To publish the package using the SharePoint transport, specify a publishType of TO_SHAREPOINT.
Type:Character, Input
rc
receives a return code.
Type:Numeric, 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:
  • APPLIED_TEXT_VIEWER_NAME
  • APPLIED_VIEWER_NAME
  • ARCHIVE_FULLPATH
  • ARCHIVE_NAME
  • ARCHIVE_PATH
  • COLLECTION_FOLDER
  • COLLECTION_URL
  • DEBUG_FILE
  • GENERATED_NAME
  • HTTP_PASSWORD
  • HTTP_USER
  • IF_EXISTS
  • INITIALIZE_SITE
  • LIST_NAME
  • PARENT_FOLDER
  • PARENT_URL
  • SITE_URL
  • TARGET_VIEW_MIMETYPE
  • TARGET_VIEW_NAME
  • TARGET_VIEWER_MIMETYPE
  • TARGET_VIEWER_NAME
  • TEXT_VIEWER_NAME
  • VIEWER_NAME
Type:Character, Input

Optional Argument

propValue1, …propValueN
specifies one value for each specified property name. The order of the property values must match the order of the property names in the properties parameter. Valid property values are defined as follows:
APPLIED_TEXT_VIEWER_NAME specifies a character string that names the rendered package view, which results from the application of the text viewer template. To specify the name of the rendered package view, use either FILEREF:SAS_fileref or FILENAME:external_filename. This property is valid only when the TEXT_VIEWER_NAME property is also specified. By default, the rendered view is created as a temporary file. This property overrides the default, causing the rendered view to be saved permanently to a file.
APPLIED_VIEWER_NAME specifies a character string that indicates the name of the rendered package view, which results from the application of the HTML viewer template. To specify the name of the rendered package view, use either FILEREF:SAS_fileref or FILENAME:external_filename. This property is valid only when the VIEWER_NAME property is also specified. By default, the rendered view is created as a temporary file. This property overrides the default, causing the rendered view to be saved permanently to a file.
ARCHIVE_FULLPATH returns the complete URL path of the published archive on the server. The URL path includes the name of the archive, as specified by ARCHIVE_NAME or the generated name if ARCHIVE_NAME is not specified. This output property is returned only if ARCHIVE_PATH is specified.
ARCHIVE_NAME specifies a character string that indicates the name of the archive file.
ARCHIVE_PATH specifies a character string that indicates the path where the archive should be created.
COLLECTION_FOLDER specifies both the parent folder and the collection folder together. This property is relative to the list name. Do not specify a value for this property if you are using the COLLECTION_URL property.
COLLECTION_URL specifies a character string that indicates the URL in which the SharePoint collection is placed. The COLLECTION_URL is specified in the following format: http://host/site/list-name/folder-name. This is the equivalent of specifying the SITE_URL, LIST_NAME, and COLLECTION_FOLDER properties separately. Do not specify a value for this property if you are using the SITE_URL, LIST_NAME, or COLLECTION_FOLDER properties. Note that when you use COLLECTION_URL, the default behavior is to replace the existing collection at that location. Do not use this property if the SharePoint URL has one of the following formats: http://host/site/subsite</subsiteN>/list-name/folder-name or http://host-is-the-sitename/list-name/folder-name.
DEBUG_FILE specifies the name of the file that will contain debug wire trace output.
GENERATED_NAME returns the name of the package, whether this value was generated by SAS or specified by another property. This property is an output property. If the package is published with a PARENT_URL, and ARCHIVE_PATH is not specified, then the package is published as a folder that contains the contents of the package and not as a .spk file. In this case, the return value for GENERATED_NAME will not be the name of the archive but the name of the package. For SharePoint, this is a folder name.
HTTP_PASSWORD indicates the password that is needed to bind to the Web server on which the package is published. Specify this property only when the Web server is secured.
HTTP_USER indicates the user ID that is needed to bind to the Web server on which the package is published. Specify this property only when the Web server is secured.
IF_EXISTS specifies one of the following character strings. Use the IF_EXISTS property to control the treatment of same-named collections already existing on the server. "NOREPLACE" indicates that if the package being published contains a collection that already exists on the server, the PUBLISH_PACKAGE call is to return immediately without affecting the contents of the existing collection. "UPDATE" indicates that if the collection already exists on the server, the PUBLISH_PACKAGE call is to update the existing collection by replacing like-named entities and adding newly named entities. If "UPDATE" is specified and both the package to publish and the existing collection have an HTML set (created with INSERT_HTML) with the same NESTED_NAME, then the HTML set in the published package replaces the HTML set in the existing collection. "UPDATEANY" is identical to "UPDATE" except that the PUBLISH_PACKAGE CALL routine can be used to update a collection that SAS did not create. A consequence of using "UPDATEANY" is that SAS will be unable to retrieve the published package. Note that when names are generated automatically for HTML set collections, the publish code ensures that name collisions will not occur.
INITIALIZE_SITE enables an administrator to initialize a SharePoint site. Before a SharePoint site is used for the first time, it must be initialized with SharePoint content types and column metadata defined by SAS.
LIST_NAME specifies a document library in the SharePoint site. SharePoint document libraries are a special type of list that is used for ordering folders and files. Do not specify a value for this property if you are using the COLLECTION_URL or PARENT_URL properties.
PARENT_FOLDER specifies the parent folder of a generated collection name. This property is relative to the list name. Do not specify a value for this property if you are using the PARENT_URL property.
PARENT_URL specifies a character string that indicates the URL under which the WebDAV collection is placed. The collection is automatically assigned a unique name. Do not specify a value for this property if you are using the SITE_URL, LIST_NAME, or PARENT_FOLDER properties.
SITE_URL defines the transfer protocol (HTTP or HTTPS), the host name, and the SharePoint site. Do not specify a value for this property if you are using the COLLECTION_URL or PARENT_URL properties.
TARGET_VIEW_MIMETYPE specifies a character string that indicates the MIME type of the rendered view for delivery to a SharePoint server. The target view MIME type overrides the default view MIME type, which is automatically inferred from the viewer. Typical MIME types are HTML (.htm) and plain text (.txt) files. If this field remains blank, then the viewer filename extension is used to locate the MIME type in the appropriate registry. Windows hosts use the Windows Registry; other hosts use the SAS Registry. The TARGET_VIEW_MIMETYPE and TARGET_VIEWER_MIMETYPE properties are synonymous.
TARGET_VIEW_NAME specifies a character string that indicates the name of the rendered view that is published with the package to the SharePoint server. The specified target view name overrides the default name, which is index.html. The TARGET_VIEW_NAME and TARGET_VIEWER_NAME properties are synonymous.
TARGET_VIEWER_MIMETYPE see TARGET_VIEW_MIMETYPE.
TARGET_VIEWER_NAME see TARGET_VIEW_NAME.
TEXT_VIEWER_NAME specifies a character string that indicates the name of a text viewer template that formats package content for later viewing by a Web browser or text editor or other program that is specific to the viewer template. Syntax is either FILEREF:SAS_fileref or FILENAME:external_filename.
VIEWER_NAME specifies a character string that indicates the name of the HTML viewer template to be applied by using either FILEREF:SAS_fileref or FILENAME:external_filename.
Type:Character or Numeric, Input or Output

Details

Default Behavior

Publishing with a publishType of TO_SHAREPOINT publishes a package to a specified URL on a SharePoint server. The HTTPS protocol is supported when publishing to a SharePoint site. SharePoint enables distributed authoring and versioning, which enables collaborative development of Web files on remote servers.
The SharePoint transport stores package entries as members of a collection.
If you specify the COLLECTION_URL property, then the package is published to the specified URL on a SharePoint server. When you use COLLECTION_URL, the default behavior is to replace the existing collection and its nested directories at that location. If you do not want to replace an existing collection and its nested directories, then you must use the IF_EXISTS property. An example of a collection URL is
http://www.host.com/AlphaliteAirways/revenue/quarter1
The collection is named quarter1.
The PARENT_URL property is similar to the COLLECTION_URL property except that it specifies the location under which the new SharePoint 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 specifications of the COLLECTION_URL property and the PARENT_URL property are mutually exclusive.
Publishing to SharePoint is similar to publishing to WebDAV. The primary difference is how the file destination is specified in the PACKAGE_PUBLISH CALL routine. Instead of the package destination being a single URL, SharePoint requires three pieces of information: SITE_URL, LIST_NAME, and PARENT_FOLDER or COLLECTION_FOLDER. However, if the SharePoint site is not nested, a single COLLECTION_URL or PARENT_URL property, which contains all information, can be used (for example, http://host/site/list-name/folder-name). SharePoint sites can be nested. For example, a site could be http://myhost/MyMainSite/SiteUnderneath. Because SharePoint sites can be nested, the SITE_NAME, LIST_NAME, and COLLECTION_FOLDER properties must be specified separately. To view a collection with a Web browser, combine all three pieces of information (for example, http://host/site/list-name/folder-name).
A COLLECTION_URL can represent only a top-level site because the SharePoint URL syntax does not allow for parsing to determine how many nested levels there are. For example, http://host/topsite/nestedsite/Documents is a nested site URL. For a nested site, the SITE_NAME, LIST_NAME, and COLLECTION_FOLDER properties must be used. If a COLLECTION_URL is mistakenly used with a nested site URL, the caller will receive an HTTP status of 404 (NOT FOUND) because the URL will not be properly parsed.
Similar to COLLECTION_URL, PARENT_URL can be used only with a top-level SharePoint site. For nested sites, SITE_NAME, LIST_NAME, and PARENT_FOLDER properties must be used.
SharePoint publishing uses the following file extensions for each item type:
File Extensions for Item Types
Item Type
File Extension
ARCHIVE
.spk
CATALOG
.stc
COMMA-SEPARATED VALUES
.csv
DATA
.stc
MDDB
.sam
REFERENCE
.ref
VIEW
.sav

Initializing the Site

Before a SharePoint site is used for the first time, it must be initialized with SharePoint content types and column metadata defined by SAS. Use the INITIALIZE_SITE property to initialize the SharePoint site.
Note that after a document library list is initialized, you can manually enable the use of content types. This step is useful if you want to view the SharePoint site with a Web browser and view the properties on the file, such as the description or expiration date. To enable the use of content types, go to Site Actions and select Site Libraries and Lists. Then customize Shared Documents and click Advanced Settings. Select Yes to allow management of content types.
To update an existing package in a site document library, you must first make sure the site library allows updates to existing packages. Go to Site Actions and select Site Settings. Next, select Site Libraries and Liststhen selectDocuments (or Shared Documents). Under Versioning settings, set Require documents to be checked out before they can be edited? to No.

Viewer Properties

If you specify the VIEWER_NAME property with the COLLECTION_URL or PARENT_URL property, then the view is rendered in HTML format. If you specify the TEXT_VIEWER_NAME with the COLLECTION_URL or PARENT_URL properties, then the view is rendered in text format.
The specified viewer is used to create a rendered view that is named index.html. To override the default name that is assigned to the rendered view, use the APPLIED_VIEWER_NAME or APPLIED_TEXT_VIEWER_NAME, as appropriate, to specify a filename for the rendered view.

Archive Path Properties

If you specify the ARCHIVE_PATH property, then an archive is created and published as a binary package on a SharePoint server. 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".
For more details about how to use the archive properties, see PACKAGE_PUBLISH (Publish Package 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.
When publishing a binary package with the SharePoint transport, you can specify the following archive properties: ARCHIVE_NAME, ARCHIVE_PATH, or ARCHIVE_FULLPATH.

Applying a Name/Value Pair to a Package and a Package Item

When publishing to SharePoint, optional name/value pairs are transmitted to the SharePoint server in XML format.
For details about specifying the nameValue parameter for a single package item, see the applicable INSERT_item CALL routine, where item can be any of the following:

Examples

Example 1: Using PACKAGE_PUBLISH with the COLLECTION_FOLDER Property to Publish to SharePoint

The following example uses the COLLECTION_FOLDER property:
publishType = 'TO_SHAREPOINT';
properties       = 'SITE_URL, LIST_NAME, COLLECTION_FOLDER, HTTP_USER, HTTP_PASSWORD';
siteUrl          = 'http://www.alphaliteairways.com/sale';
listName         = 'fares';
collectionFolder = 'Fare Lists';
userName         = 'JohnSmith';
password         = 'secret';

CALL PACKAGE_PUBLISH(packageId, publishType, rc, properties, 
   siteUrl, listName, collectionFolder, userName, password);

Example 2: Using PACKAGE_PUBLISH with the COLLECTION_URL Property to Publish to SharePoint

The following example uses the COLLECTION_URL property:
publishType = 'TO_SHAREPOINT';
properties    = 'COLLECTION_URL, HTTP_USER, HTTP_PASSWORD';
collectionUrl = 'http://www.alphaliteairways.com/sale/fares/Fare Lists';
userName      = 'vicdamone';
password      = 'myway';

CALL PACKAGE_PUBLISH(packageId, publishType, rc,
   properties, collectionUrl, userName, password);

Example 3: Using PACKAGE_PUBLISH with the INITIALIZE_SITE Property to Initialize a Site and Publish to SharePoint

Before a SharePoint site can be used, it must be initialized by an administrator. To initialize the site, use the INITIALIZE_SITE property, as follows:
publishType = 'TO_SHAREPOINT';
properties  = 'SITE_URL, LIST_NAME, HTTP_USER, HTTP_PASSWORD, INITIALIZE_SITE';
siteUrl     = 'http://www.alphaliteairways.com/';
userName    = 'vicdamone';
password    = 'myway';
initialize  = 'TRUE';

CALL PACKAGE_PUBLISH(packageId, publishType, rc, properties, 
   siteUrl, listName, userName, password, initialize);