Skip to content

Commit

Permalink
Merge pull request #2100 from Esri/jy-upd-admin-samples
Browse files Browse the repository at this point in the history
Add folder syntax to replace upcoming content.add deprecation
  • Loading branch information
jyaistMap authored Oct 11, 2024
2 parents c947215 + 226710d commit 511f61d
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 8 deletions.
20 changes: 16 additions & 4 deletions samples/03_org_administrators/validate_item_metadata.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"\n",
"import pandas as pd\n",
"\n",
"from arcgis.gis import GIS"
"from arcgis.gis import GIS, ItemTypeEnum, ItemProperties"
]
},
{
Expand Down Expand Up @@ -466,7 +466,19 @@
}
],
"source": [
"gis.content.add({}, output_dir + out_file)"
"root_folder = gis.content.folders.get()\n",
"\n",
"new_item_props = ItemProperties(\n",
" \"title\":out_file,\n",
" \"type\":ItemTypeEnum.CSV.value,\n",
" \"tags\":\"item_metatdata_report\",\n",
" \"snippet\":\"Report on item attributes from API\"\n",
")\n",
"\n",
"root_folder.add(\n",
" item_properties=new_item_props,\n",
" file=os.path.join(output_dir + out_file)\n",
").result()"
]
},
{
Expand Down Expand Up @@ -516,7 +528,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.16"
"version": "3.11.0"
},
"toc": {
"base_numbering": 1,
Expand All @@ -533,5 +545,5 @@
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}
20 changes: 16 additions & 4 deletions samples/03_org_administrators/validate_user_profiles.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"\n",
"import pandas as pd\n",
"\n",
"from arcgis.gis import GIS"
"from arcgis.gis import GIS, ItemPropertie, ItemTypeEnum"
]
},
{
Expand Down Expand Up @@ -281,7 +281,19 @@
}
],
"source": [
"gis.content.add({}, output_dir + out_file)"
"item_props = ItemProperties(\n",
" \"title\" = out_file,\n",
" \"type\" = ItemTypeEnum.CSV,\n",
" \"tags\" = \"user_profile_report\",\n",
" \"snippet\" = \"Report on user profile data from Python API\"\n",
")\n",
"\n",
"root_folder = gis.content.folders.get()\n",
"\n",
"gis.content.add(\n",
" item_properties = item_props,\n",
" file= os.path.join(output_dir + out_file)\n",
").result()"
]
},
{
Expand Down Expand Up @@ -331,7 +343,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.16"
"version": "3.11.0"
},
"toc": {
"base_numbering": 1,
Expand All @@ -348,5 +360,5 @@
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}

0 comments on commit 511f61d

Please sign in to comment.