Share Package (Data Management)

License Level:BasicStandardAdvanced

Summary

Shares a package by uploading to ArcGIS online

Usage

Syntax

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

Input layer (.lpk), map (.mpk), geoprocessing (.gpk), map tile (.tpk), or address locator (.gcpk) package file.

File
username

Esri Global Account user name.

String
password

Esri Global Account password.

Encrypted String
summary

Summary of package. The summary is displayed in the item information of the package on ArcGIS.com.

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

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: SharePackageEx1.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

from arcpy import env

# Set environment settings
env.overwriteOutput = True
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

Related Topics

Licensing Information

ArcGIS for Desktop Basic: Yes
ArcGIS for Desktop Standard: Yes
ArcGIS for Desktop Advanced: Yes
11/18/2013