Select to view content in your preferred language

Using ItemProperties class and Item object update() method fails to update the properties.

261
2
07-31-2024 03:46 AM
Labels (1)
Clubdebambos
Occasional Contributor III

The ItemProperties class introduced as of API version 2.3.0 does not seem to work when updating an Item object, or perhaps I am missing something? Any help greatly appreciated.

The documentation for the ItemProperties states that the title and item_type parameters are required, why would you need these if you are updating and item? I can understand if using an add() method.

Anyway, I have failed in attempts to use the ItemProperties to update and Item.

    """set the tags property for the item properties"""
    item_properties = ItemProperties(
        title = item.title,
        item_type = item.type,
        tags = tags
    )

    """perform the update on the item object"""
    status = item.update(
        item_properties = item_properties
    )

    print(status)

 

I also attempted to add the parameter overwrite = True to no affect. I get the following error.

TypeError: argument of type 'ItemProperties' is not iterable

 

Has anyone successfully used the ItemProperties with an update() or is this an actual bug?

Cheers,

Glen

~ learn.finaldraftmapping.com
0 Kudos
2 Replies
EdMorris
Esri Contributor

Hello!

Did you ever find a solution for this?

I wonder if you are creating the wrong object for the update() method on the item object?

If you look at the documentation for the Item.update() method:

arcgis.gis module | ArcGIS API for Python

...you will notice that the item_properties argument requires a Python dictionary and not an ItemProperties object which you are creating.

EdMorris_0-1722513307933.png

The key : value descriptions for the item_properties dictionary are underneath parameter list for the method.

I hope this helps!?

many thanks ed

Clubdebambos
Occasional Contributor III

Hi @EdMorris,

Thank you for your response. I know I can use a dictionary, but it seems that the API is going class driven with ItemProperties, ItemTypeEnums, and SharingLevel for examples and hints that the ItemProperties can be used for update() methods as per snippet below. So either the documentation is misleading/missing pertinent information, or it has not been implemented in the API for update() methods to accept the ItemProperties / bug.

Clubdebambos_0-1722956299664.png

 

~ learn.finaldraftmapping.com
0 Kudos