[英]Date field from Power automate to sharepoint list
I have set automate up to parse an email i recieve regularly.我已经设置了自动解析我定期收到的电子邮件。 The email is system generated through third party software without an API to link directly to SharePoint.电子邮件是通过第三方软件系统生成的,没有直接链接到 SharePoint 的 API。
I have used the initialise variable function to parse the HTML from the email and create a new list item.我使用了初始化变量函数来解析电子邮件中的 HTML 并创建一个新的列表项。
All fields work, however the Date will not pull through and fails the flow entirely.所有字段都有效,但是 Date 不会通过并完全使流程失败。
I get this error:我收到此错误:
The 'inputs.parameters' of workflow operation 'Create_item' of type 'OpenApiConnection' is not valid. “OpenApiConnection”类型的工作流操作“Create_item”的“inputs.parameters”无效。 Error details: Input parameter 'item/DateTime' is required to be of type 'String/date'.错误详情:输入参数“item/DateTime”必须是“String/date”类型。 The runtime value '"25/02/2022"' to be converted doesn't have the expected format 'String/date'.要转换的运行时值“25/02/2022”不具有预期的格式“字符串/日期”。
My column settings in the List are Date & Time field with Date Only set.我在列表中的列设置是日期和时间字段,其中仅设置了日期。
I hope I've understood your problem correctly but the format 25/02/2022
is not considered to be a valid ISO 8601 date.我希望我已正确理解您的问题,但格式25/02/2022
不被视为有效的 ISO 8601 日期。
I created a variable called Date Time String
and stored your date of 25/02/2022
.我创建了一个名为Date Time String
的变量并存储了您的日期25/02/2022
。
To make it valid, you need to convert it and to do that, this expression should do the trick.为了使其有效,您需要对其进行转换并为此进行转换,这个表达式应该可以解决问题。
concat(split(variables('Date Time String'), '/')[2], '-', split(variables('Date Time String'), '/')[1], '-', split(variables('Date Time String'), '/')[0])
It essentially reverses the date into a format that SharePoint will accept.它实质上将日期反转为 SharePoint 将接受的格式。
You can also parse the date time and then use formatDateTime
to output the format you want, see below:您也可以解析日期时间,然后使用formatDateTime
输出您想要的格式,见下文:
formatDateTime(parseDateTime(variables('Date Time String'), '', 'dd/MM/yyyy'))
Note: In the example above I did not specify a format for formatDateTime (only the parsing step), this will default to outputting the datetime in ISO format which is compatible with SharePoint.注意:在上面的示例中,我没有为 formatDateTime 指定格式(仅解析步骤),这将默认以与 SharePoint 兼容的 ISO 格式输出日期时间。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.