英文:
How can I attach file with the latest date filename to an email from Share point folder using power automate?
问题
我有一个位于以下位置的SharePoint文件夹...
> sharepoint/sites/EmailAutomation/Documents/NewFileForAutomation
...其中包含Excel文件,文件名的顺序如下(销售 01-02-2023,销售 02-02-2023,销售 03-02-2023)。我想要将具有最新日期的文件附加到电子邮件中,使用Power Automate。我想要每天发送这封电子邮件。
我的流程现在如下所示。
而我的SharePoint文件夹如下所示。
在这种情况下,我想要附加具有最新日期的文件,即“销售 15-05-2023”。
我无法找到如何在“使用路径获取文件内容”中选择文件路径时使用任何条件的线索。有没有更好的解决方法来解决这个问题?我找不到类似的问题。
英文:
I have a SharePoint folder on the location ...
> sharepoint/sites/EmailAutomation/Documents/NewFileForAutomation
... where it contains excel files and name order is like (Sales 01-02-2023, Sales 02-02-2023, Sales 03-02-2023) I want to attach the file with the latest date to an email using power automate. I want to send this email once in a day.
My flow now looks like this.
And my SharePoint folder looks like this
I want to attach file with the latest date in this case "Sales 15-05-2023".
I am not able to get any clue how I can use any condition while choosing the file path in "Get file content using path". Is there any better way to resolve this issue? I am not able to find the similar issues.
答案1
得分: 1
现在,你只需要使用一个表达式来获取当前日期的格式化,并将其传递给“使用路径获取文件内容”的SharePoint操作...
这是嵌在常量文本中的表达式...
formatDateTime(utcNow(), 'dd-MM-yyyy')
现在,唯一的注意事项是,你可能需要根据你的时区和在流运行时你认为的当前日期来调整这个表达式。我无法直接帮助你处理这个问题,除非指引你使用convertFromUtc()
函数和类似的函数。
英文:
So all you need to do is use an expression to get the current date formatted and then pass that into the Get file content using path
SharePoint operation ...
This is the expression that sits amongst the constant text ...
formatDateTime(utcNow(), 'dd-MM-yyyy')
Now, the only caveat here is that you may need to adjust the expression depending on your timezone and what you consider to be the current date when you flow runs. I can't help you with that directly other than to point you towards the convertFromUtc()
function and those like it.
Result
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论