如何获取我从副本创建的新文件夹/工作表的 ID? [英] How do I get the ID of a new folder/sheet that I have created from a copy?

查看:16
本文介绍了如何获取我从副本创建的新文件夹/工作表的 ID?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

When I make a copy of a folder in smartsheet, is there a way to get the ID of the new folder?

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

What I have tried so far is this:

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)

这给了我一个看起来像这样的长响应:

This gives me a long response that looks like this:

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

{"folders": [{"id": 1261015317931908, "name": "Title Test Cell", "permalink": "permalink goes here"}], "id": 6664015456823172, "name": "Smartsheet Folder Destination", "permalink": "permalink goes here (I edited it)"}

如何只获取新文件夹的 id?

How do I get just the id of the new folder?

推荐答案

当您创建新文件夹(或从现有文件夹复制)时,响应将包括新文件夹的几个属性,包括 id.如果您不需要其他属性,请忽略它们.

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.

来自 API 文档:

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

所以在 Python 中,在你得到你的回应之后:

So in Python, after you get your response:

folder_id = response.result.id

这篇关于如何获取我从副本创建的新文件夹/工作表的 ID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆