1

当我在 smartsheet 中复制文件夹时,有没有办法获取新文件夹的 ID?

到目前为止,我尝试过的是:

inc_list = ['all'] # you can add other parameters here, separated by a comma
 response = ss_client.Folders.copy_folder(
 folderID,                           # folder_id
 ss_client.models.ContainerDestination({
'destination_id': destinationID,
'destination_type': 'folder',
'new_name': cellValue
}),
include=inc_list
)

folder = ss_client.Folders.get_folder(
destinationID)       # folder_id

print (folder)

这给了我一个长长的回复,看起来像这样:

{"folders": [{"id": 1261015317931908, "name": "Title Test Cell", "permalink": "permalink goes here"}], "id": 6664015456823172, "name": "Smartsheet Folder Destination" ,“永久链接”:“永久链接在这里(我编辑过)”}

如何获取新文件夹的 ID?

4

1 回答 1

2

When you create a new folder (or copy from an existing folder), the response will include several attributes of the new folder, including the id. If you don't need the other attributes, just ignore them.

From the API docs:

{
  "message": "SUCCESS",    
  "resultCode": 0,
  "result": {
    "id": 7116448184199044,
    "name": "newFolderName",
    "permalink": "https://{base_url}?lx=lB0JaOh6AX1wGwqxsQIMaA"
  }
}

So in Python, after you get your response:

folder_id = response.result.id
于 2018-08-01T18:10:00.523 回答