当我在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)
这给了我一个很长的响应,看起来像这样:
{“文件夹”:[{“ id”:1261015317931908,“名称”:“标题测试单元”,“永久链接”:“永久链接在此处”}},“ id”:6664015456823172,“名称”:“ Smartsheet文件夹目标”,“永久链接”:“永久链接在这里(我对其进行了编辑)”}
如何仅获取新文件夹的ID?
答案 0 :(得分:2)
创建新文件夹(或从现有文件夹复制)时,响应将包括新文件夹的多个属性,包括ID。如果不需要其他属性,请忽略它们。
来自API docs:
{
"message": "SUCCESS",
"resultCode": 0,
"result": {
"id": 7116448184199044,
"name": "newFolderName",
"permalink": "https://{base_url}?lx=lB0JaOh6AX1wGwqxsQIMaA"
}
}
因此在Python中,得到响应后:
folder_id = response.result.id