Share Package to Multiple Groups on Portal Issue

226
0
11-09-2023 08:36 AM
cecesm
by
New Contributor

I am working on scripting the publishing of .mmpk files to my organization's arcgis.com/portal. 

I have already created the mmpk and am working to overwrite existing mmpks with the same name using the following function:

# Function to publish mmpk to Enterprise
def mmpk_publish(
    mmpk,
    username,
    password,
    summary,
    tags,
    credits,
    public,
    groups,
    my_logger,
    login_url,
):
    portal_sign_in(login_url, my_logger)
    try:
        arcpy.management.SharePackage(
            mmpk,
            username,
            password,
            summary,
            tags,
            credits,
            public,
            groups,
        )
        my_logger.info(f"{mmpk} was successfully published.")
    except Exception as e:
        error_message = f"Failed to publish {mmpk}: {e}"
        my_logger.error(error_message)

 

The issue I'm running into is when I need to add more than one "group" for the mmpk to be shared with. 

For example:

mmpk_publish(
    mt_mmpk,
    "",
    "",
    f"Mobile map package update for MT / WY MDU. This map is set to expire on {expiration_date}.",
    "",
    "",
    "",
    "'Wyoming Maps'; 'Montana Maps'",
    my_logger,
    login_url,
)

In the above, I have two groups on our Enterprise ("Wyoming Maps" and "Montana Maps") that the mmpk needs to be shared with, and it is only sharing with the first one listed ("Wyoming Maps"). 

I referred to the "Share Package" tool in ArcPro and by doing a mock-share in Pro and copying the python command to ensure I had to format correct for multiple-group sharing. 

I am not sure where the issue is coming from, anyone else experienced this or have any thoughts?

 

Thanks --

0 Kudos
0 Replies