Share Package (Data Management)

Summary

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

Usage

  • The following are supported package types:

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

    Tip:

    If you have a scene layer package that is larger than 500 GB and want to publish it as a web scene layer to ArcGIS Online, add it to a 3D scene and share it as a web scene instead. The scene layer package is published as a web scene layer with the web scene. If you have a voxel scene layer package in your scene, you can share it as a web scene layer directly. Right-click the layer, point to the Sharing menu, and click Share As Web Layer Share As Web Layer.

  • You cannot enter your ArcGIS Online or ArcGIS Enterprise username 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 using this tool.

  • A summary and one or more tags are required when sharing a package to an ArcGIS Enterprise 10.9 or earlier portal. The 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 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.

Parameters

LabelExplanationData Type
Input Package

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

File
Username

The ArcGIS Online or Portal for ArcGIS username.

This parameter is not available on the tool dialog box. You must sign in to the active 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 the active portal from the sign in option at the upper right of the application.

Encrypted String
Summary
(Optional)

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

String
Tags
(Optional)

The tags used to describe and identify the package. Individual tags are separated using either a comma or a 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 groups. 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 or .lpkx), scene layer (.slpk), map (.mpk or .mpkx), geoprocessing (.gpk, .gpkx), tile (.tpk or .tpkx), mobile map (.mmpk), vector tile (.vtpk), address locator (.gcpk), or project (.ppkx or .aptx) package file.

File
username

The ArcGIS Online or ArcGIS Enterprise username. This parameter has been deprecated and should consist of an empty string. Before running the Python script, you must sign in to the active portal from the application. Alternatively, you can sign in using the SignInToPortal function.

String
password

The ArcGIS Online or ArcGIS Enterprise password. This parameter has been deprecated and should consist of an empty string. Before running the Python script, you must sign in to the active portal from the application. Alternatively, you can sign in using the SignInToPortal function.

Encrypted String
summary
(Optional)

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

String
tags
(Optional)

The tags used to describe and identify the package. Individual tags are separated using either a comma or a 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 groups. 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.management.SharePackage(r"C:\states.lpkx", "", "", 
                              "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.management.SharePackage(r"C:\states.tpk", "", "", 
                              "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.management.SharePackage(mpkx, "", "", 
                                  "My Summary", "tag1, tag2", 
                                  "My Credits", "MYGROUPS", "My Group")

Environments

Licensing information

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

Related topics