嗨@vgrem @Toilal ,
我正在查看您的代码并试图找出在共享点列表中创建新行的代码,添加“请求 ID”字符串及其附件文件。
这是我需要做的:
如红色箭头所示,我需要添加“REQUEST_ID”字符串并添加“附件”文件。
我看到了一些上传文件的代码,但没有找到与附件相关的任何内容。
非常欢迎任何帮助!
TKS
问候@libora6 ,
这是一个通用示例,演示如何:
ctx = ClientContext(site_url).with_credentials(ClientCredential(client_id, client_secret))
list_object = ctx.web.lists.get_by_title(list_title)
# 1. create a list item first
new_item = list_object.add_item({
"Title": "Task 123"
}).execute_query()
# 2. upload attachment into list item
with open(attachment_path, 'rb') as content_file:
file_content = content_file.read()
attachment_file_name = os.path.basename(attachment_path)
attachment_file_information = AttachmentfileCreationInformation(attachment_file_name, file_content)
attachment_file = new_item.attachmentFiles.add(attachment_file_information).execute_query()
笔记:
Title
,在您的情况下,请确保为字段REQUEST_ID
指定正确的名称结果
@vgrem tks 为您提供及时的支持。