Skip To Content

Share Package

Summary

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

Usage

  • Supported package types include:

    • geoprocessing packages (.gpk, .gpkx)
    • layer packages (.lpk, .lpkx)
    • locator packages (.gcpk)
    • map packages (.mpk, .mpkx)
    • map tile packages (.tpk)
    • mobile map packages (.mmpk)
    • scene layer packages (.slpk)
    • vector tile packages (.vtpk)
    • project packages and project templates (.ppkx, .aptx)

  • You will not be able to enter your ArcGIS Online or ArcGIS Enterprise user name and password when using this tool inside ArcGIS Pro. The tool will obtain your credentials from ArcGIS Pro, itself. You must be logged 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 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.

  • To share a package to ArcGIS Online with a public account, your Esri Global Account needs to be registered as a member of ArcGIS Online. To create an Esri Global Account and register it, 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. The ArcGIS Online for example, uses this authentication method. To authenticate, you must connect directly to the portal from the application. You will only be able to use this tool in a Python script if the application is open and connected to the portal, or you're connecting to a portal which uses traditional authentication mechanisms and allow the user name and password to be passed in.

Syntax

SharePackage_management (in_package, username, password, summary, tags, {credits}, {public}, {groups}, {organization})
ParameterExplanationData Type
in_package

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

File
username

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

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

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

String
tags

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

String
credits
(Optional)

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 input package will be shared and available to everybody.

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

List of groups to share package with.

String
organization
(Optional)

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

  • EVERYBODY Package will be shared with everybody. This is the default.
  • MYORGANIZATION Package will be shared within your organization only.
Boolean

Code sample

SharePackage example 1 (Python window)

Code sample that takes a layer package and shares it to ArcGIS Online.

import arcpy
arcpy.SharePackage_management(r"C:\states.lpk", "username", "password", 
                              "this is a summary", "tag1, tag2", "Credits", 
                              "MYGROUPS", "My_Group")
SharePackage example 2 (stand-alone script)

Find all the map packages that reside in a specified folder and share them on ArcGIS Online.

# Name: SharePackageExample.py
# Description:  Find all the map packages that reside in a specified folder 
#               and share them on ArcGIS online.

# 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, find all the layer and map packages 
for mpk in arcpy.ListFiles("*.mpk"):
    print("Sharing " + mpk)
    arcpy.SharePackage_management(mpk, "username", "password", 
                                  "This is a summary", "tag1, tag2", 
                                  "Credits", "MYGROUPS", "My_Group")

Environments

Licensing information

  • ArcGIS Desktop Basic: Yes
  • ArcGIS Desktop Standard: Yes
  • ArcGIS Desktop Advanced: Yes

Related topics