Hello,
I have a script that updates the vector basemap, what I would like for the script to do is enable offline mode after it has updated the vector basemap I have done a lot of searching and cant seem to find the code that would enable this. below is a copy of the script.
I imagine it would come in under this line # Replace Field Maps Basemap
# Name: CreateVectorTilePackage.py
# Description: Find all the maps in the project and
# create a vector tile package for each map
# import system modules
import os
import arcpy
#set environment settings
arcpy.env.overwriteOutput = True
# Share Field Maps Basemap package online
print("Starting Packaging Basemap")
TempHarvestBasemap = arcpy.SharePackage_management(r"L:\GIS\ArcGIS Pro Projects\Vector_Tiles\TempPackages\TEMPFieldMapsBasemap.vtpk", "AUSERNAME", "APASSWORD",
"Authoritive Field Collection Base Map", "Field, Vector Basemap", "Created from arcgis pro vector tiles",
"MYGROUPS", "ABC", "MYORGANIZATION", "True",
"Packages")
print("Uploaded TempFieldMapsBasemap")
# Login to AGOL
from arcgis.gis import GIS
gis = GIS("https://www.arcgis.com", "AUSERNAME", "APASSWORD")
print("Logged in")
# Update the Field Maps Base Map
# Search for a layer
print("searching for layer")
package = gis.content.search(query="title:TempFieldMapsBasemap",item_type="Vector Tile Layer" )[0]
# Replace Field Maps Basemap
print ("replacing field maps basemap")
gis.content.replace_service('503aacb9c3c146f0ba5d25847ebd6f87',package,"FieldMapsBaseREPLACE",True)
# Search for update layer
print ("searching for temporary layer")
package = gis.content.search(query="title: FieldMapsBaseREPLACE",item_type="Vector Tile Layer" )[0]
# Delete Update Layer
print("deleting temporary layer")
package.delete()
print ("Done")
Cheers