AnsweredAssumed Answered

Handle Item Move to Folder Error

Question asked by krobine on Oct 17, 2019
Latest reply on Oct 17, 2019 by krobine

I am attempting to move an item to a specific folder (using Python API, NOT Juypter). I don't see anything in the API to check if a folder exists. So according to the API:


move(folder, owner=None)

Moves this item to the folder with the given name.

folderRequired string. The name of the folder to move the item to. Use ‘/’ for the root folder. For other folders, pass in the folder name as a string, or a dictionary containing the folder ID, such as the dictionary obtained from the folders property.
ownerOptional string or Owner object. The name of the user to move to.
Returns:A json object like the following: {“success”: true | false,
”itemId”: “<item id>”, “owner”: “<owner username>”, “folder”: “<folder id>”}


I'm trying to figure out how to capture the return object.  I've wrapped it in a Try/Catch but that doesn't seem to work.  It always gets to the next line but I get the console message, Folder not found for given owner.

If I do:

objMoved = myItem.move(folder="whatever")

objMoved is always None


What's the "best practice" way to get the results?