Skip to content

Commit 511f61d

Browse files
authored
Merge pull request #2100 from Esri/jy-upd-admin-samples
Add folder syntax to replace upcoming content.add deprecation
2 parents c947215 + 226710d commit 511f61d

File tree

2 files changed

+32
-8
lines changed

2 files changed

+32
-8
lines changed

samples/03_org_administrators/validate_item_metadata.ipynb

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"\n",
4949
"import pandas as pd\n",
5050
"\n",
51-
"from arcgis.gis import GIS"
51+
"from arcgis.gis import GIS, ItemTypeEnum, ItemProperties"
5252
]
5353
},
5454
{
@@ -466,7 +466,19 @@
466466
}
467467
],
468468
"source": [
469-
"gis.content.add({}, output_dir + out_file)"
469+
"root_folder = gis.content.folders.get()\n",
470+
"\n",
471+
"new_item_props = ItemProperties(\n",
472+
" \"title\":out_file,\n",
473+
" \"type\":ItemTypeEnum.CSV.value,\n",
474+
" \"tags\":\"item_metatdata_report\",\n",
475+
" \"snippet\":\"Report on item attributes from API\"\n",
476+
")\n",
477+
"\n",
478+
"root_folder.add(\n",
479+
" item_properties=new_item_props,\n",
480+
" file=os.path.join(output_dir + out_file)\n",
481+
").result()"
470482
]
471483
},
472484
{
@@ -516,7 +528,7 @@
516528
"name": "python",
517529
"nbconvert_exporter": "python",
518530
"pygments_lexer": "ipython3",
519-
"version": "3.7.16"
531+
"version": "3.11.0"
520532
},
521533
"toc": {
522534
"base_numbering": 1,
@@ -533,5 +545,5 @@
533545
}
534546
},
535547
"nbformat": 4,
536-
"nbformat_minor": 2
548+
"nbformat_minor": 4
537549
}

samples/03_org_administrators/validate_user_profiles.ipynb

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"\n",
4545
"import pandas as pd\n",
4646
"\n",
47-
"from arcgis.gis import GIS"
47+
"from arcgis.gis import GIS, ItemPropertie, ItemTypeEnum"
4848
]
4949
},
5050
{
@@ -281,7 +281,19 @@
281281
}
282282
],
283283
"source": [
284-
"gis.content.add({}, output_dir + out_file)"
284+
"item_props = ItemProperties(\n",
285+
" \"title\" = out_file,\n",
286+
" \"type\" = ItemTypeEnum.CSV,\n",
287+
" \"tags\" = \"user_profile_report\",\n",
288+
" \"snippet\" = \"Report on user profile data from Python API\"\n",
289+
")\n",
290+
"\n",
291+
"root_folder = gis.content.folders.get()\n",
292+
"\n",
293+
"gis.content.add(\n",
294+
" item_properties = item_props,\n",
295+
" file= os.path.join(output_dir + out_file)\n",
296+
").result()"
285297
]
286298
},
287299
{
@@ -331,7 +343,7 @@
331343
"name": "python",
332344
"nbconvert_exporter": "python",
333345
"pygments_lexer": "ipython3",
334-
"version": "3.7.16"
346+
"version": "3.11.0"
335347
},
336348
"toc": {
337349
"base_numbering": 1,
@@ -348,5 +360,5 @@
348360
}
349361
},
350362
"nbformat": 4,
351-
"nbformat_minor": 2
363+
"nbformat_minor": 4
352364
}

0 commit comments

Comments
 (0)