Share Package (Data Management)

Summary

Shares a package by uploading it to ArcGIS Online or ArcGIS Enterprise.

Usage

  • The package file size limit is 500 GB. For more information, see Considerations and limitations.

  • The following are supported package types:

  • You cannot enter your ArcGIS Online or ArcGIS Enterprise user name and password when using this tool in ArcGIS Pro. The tool will obtain your credentials from ArcGIS Pro. You must be signed in and connected to ArcGIS Online or ArcGIS Enterprise before you can share a package with this tool.

  • To share a package with ArcGIS Online or ArcGIS Enterprise, a summary and one or more tags are required. The required summary and tags, along with an optional package description and credits, will be used when searching for packages online.

  • If a package of the same name already exists in your ArcGIS Online or ArcGIS Enterprise organization, it will be overwritten.

  • If you share a tile package, scene layer package, or vector tile package, you can publish the package automatically as a web layer of the corresponding type. (A tile package is published as a web tile layer, a scene layer package as a web scene layer, and a vector tile package as a vector tile layer.) To publish a web layer successfully, you must have the necessary privileges in your active portal account.

  • To share a package to ArcGIS Online with a public account, your Esri Global Account must be registered as a member of ArcGIS Online. To create and register an Esri Global Account, go to arcgis.com/home/signup.html.

  • Note:

    This tool may have limited use in a Python script outside of ArcGIS applications when sharing a package to a portal that uses OAUTH2 authentication. ArcGIS Online for example, uses this authentication method. To authenticate, you must connect directly to the portal from the application. You can only use this tool in a Python script if the application is open and connected to the portal, or you're connecting to a portal that uses traditional authentication mechanisms and allows the user name and password to be passed in.

Parameters

LabelExplanationData Type
Input Package

The input layer (.lpk, .lpkx), scene layer (.slpk), map (.mpk, .mpkx), geoprocessing (.gpk, .gpkx), tile (.tpk, .tpkx), mobile map (.mmpk), vector tile (.vtpk), address locator (.gcpk), or project (.ppkx, .aptx) package file.

File
Username

The ArcGIS Online or Portal for ArcGIS user name.

This parameter is not available on the tool dialog box. You must sign in to a portal from the sign in option at the upper right of the application.

String
Password

The ArcGIS Online or ArcGIS Enterprise password.

This parameter is not available on the tool dialog box. You must sign in to a portal from the sign in option at the upper right of the application.

Encrypted String
Summary

The summary of the package. The summary is displayed in the item information of the package on ArcGIS Online or ArcGIS Enterprise.

String
Tags

The tags used to describe and identify the package. Individual tags are separated using either a comma or semicolon.

String
Credits
(Optional)

The credits for the package. This is generally the name of the organization that is given credit for authoring and providing the content for the package.

String
Share with everyone
(Optional)

Specifies whether the input package will be shared with and available to everybody.

  • Checked—The input package will be shared with everybody.
  • Unchecked—The input package will be shared with the package owner and any selected group. This is the default.
Boolean
Groups
(Optional)

The groups the package will be shared with.

String
Share within organization only
(Optional)

Specifies whether the input package will be available within your organization only or shared publicly with everyone.

  • Everybody The package will be shared with everybody. This is the default.
  • Within my organization The package will be shared within your organization only.
Boolean
Publish web layer
(Optional)

Specifies whether the package will be published as a web layer to your portal. Only tile packages, vector tile packages, and scene layer packages are supported.

  • Unchecked—The package will be uploaded without publishing. This is the default.
  • Checked—The package will be uploaded and published as a web layer with the same name.
Boolean
Folder
(Optional)

An existing folder or the name of a new folder on the portal for the package. If a web layer is published, it is stored in the same folder.

String

Derived Output

LabelExplanationData Type
Tool Succeeded

The result of uploading the package and publishing the web layer if specified. Returns True on success.

Boolean
Package Item ID

The portal item ID of the package.

String
Publish Results

The JSON response containing the service URL and portal item ID of the web layer.

String

arcpy.management.SharePackage(in_package, username, password, summary, tags, {credits}, {public}, {groups}, {organization}, {publish_web_layer}, {portal_folder})
NameExplanationData Type
in_package

The input layer (.lpk, .lpkx), scene layer (.slpk), map (.mpk, .mpkx), geoprocessing (.gpk, .gpkx), tile (.tpk, .tpkx), mobile map (.mmpk), vector tile (.vtpk), address locator (.gcpk), or project (.ppkx, .aptx) package file.

File
username

The ArcGIS Online or ArcGIS Enterprise user name. This parameter will have limited use from a Python script when sharing a package to a portal that uses OAUTH2 authentication. See the usage notes for more information.

String
password

The ArcGIS Online or ArcGIS Enterprise password. This parameter will have limited use from a Python script when sharing a package to a portal that uses OAUTH2 authentication. See the usage notes for more information.

Encrypted String
summary

The summary of the package. The summary is displayed in the item information of the package on ArcGIS Online or ArcGIS Enterprise.

String
tags

The tags used to describe and identify the package. Individual tags are separated using either a comma or semicolon.

String
credits
(Optional)

The credits for the package. This is generally the name of the organization that is given credit for authoring and providing the content for the package.

String
public
(Optional)

Specifies whether the input package will be shared with and available to everybody.

  • EVERYBODY The input package will be shared with everybody.
  • MYGROUPS The input package will be shared with the package owner and any selected group. This is the default.
Boolean
groups
[group_name,...]
(Optional)

The groups the package will be shared with.

String
organization
(Optional)

Specifies whether the input package will be available within your organization only or shared publicly with everyone.

  • EVERYBODY The package will be shared with everybody. This is the default.
  • MYORGANIZATION The package will be shared within your organization only.
Boolean
publish_web_layer
(Optional)

Specifies whether the package will be published as a web layer to your portal. Only tile packages, vector tile packages, and scene layer packages are supported.

  • FALSEThe package will be uploaded without publishing. This is the default.
  • TRUEThe package will be uploaded and published as a web layer with the same name.
Boolean
portal_folder
(Optional)

An existing folder or the name of a new folder on the portal for the package. If a web layer is published, it is stored in the same folder.

String

Derived Output

NameExplanationData Type
out_results

The result of uploading the package and publishing the web layer if specified. Returns True on success.

Boolean
package_item_id

The portal item ID of the package.

String
publish_results

The JSON response containing the service URL and portal item ID of the web layer.

String

Code sample

SharePackage example 1 (Python window)

The following script uploads a layer package to the active portal.

import arcpy
arcpy.SharePackage_management(r"C:\states.lpkx", "username", "password", 
                              "My Summary", "tag1, tag2", "My Credits", 
                              "MYGROUPS", "My Group")
SharePackage example 2 (Python window)

The following script uploads a tile package to the active portal and publishes it as a web layer.

import arcpy
arcpy.SharePackage_management(r"C:\states.tpk", "username", "password", 
                              "My Summary", "tag1, tag2", "My Credits", 
                              "MYGROUPS", "My Group", "MYORGANIZATION", "TRUE", 
                              "My Folder")
SharePackage example 3 (stand-alone script)

The following script finds all map packages that reside in a specified folder and uploads them to the active portal.

# Name: SharePackageExample.py
# Description:  Find all map packages that reside in a specified folder 
#               and upload them to the active portal.

# import system modules
import os
import arcpy

# Set environment settings
arcpy.env.overwriteOutput = True
arcpy.env.workspace = "C:/data/my_packages" 

# Loop through the workspace to find all map packages 
for mpkx in arcpy.ListFiles("*.mpkx"):
    print("Uploading " + mpkx)
    arcpy.SharePackage_management(mpkx, "username", "password", 
                                  "My Summary", "tag1, tag2", 
                                  "My Credits", "MYGROUPS", "My Group")

Environments

Licensing information

  • Basic: Yes
  • Standard: Yes
  • Advanced: Yes

Related topics