我正在尝试构建一个Mulesoft应用程序,它将从Sharepoint站点上的文件夹中获取一个XML文件。一旦该文件被放到文件夹中,我将尝试捡起并进行处理,在Salesforce中创建记录。一旦它被拿起,我需要从源文件夹中移除(移动)到存档文件夹,这是我无法做到的。
下面是文件拾取的设置
<flow name="listener-flow" doc:id="1a2f1eb3-0d64-45bd-9a61-9faf7b102c0d" >
<sharepoint:created-objects doc:name="On New Objects" doc:id="c87373ee-8251-4f62-ae01-2a4969923d6e" config-ref="Sharepoint_Sharepoint_online" objectType="FILE" path="${sharepoint.listener.path}" recursive="true">
<scheduling-strategy >
<fixed-frequency frequency="${sharepoint.listener.polling.frequency}" timeUnit="SECONDS" startDelay="${sharepoint.listener.polling.startDelay}"/>
</scheduling-strategy>
</sharepoint:created-objects>
<sharepoint:file-get-content doc:name="File get content" doc:id="c4ff33bb-d232-4194-a727-cb6e18ea83c5" config-ref="Sharepoint_Sharepoint_online" fileServerRelativeUrl="#[payload.ServerRelativeUrl]"/>
<ee:transform doc:name="Map File Content to JSON" doc:id="70fbc3d7-9e37-4197-af61-5594cd6dc719" >
<ee:message >
<ee:set-payload ><![CDATA[%dw 2.0
output application/json
---
read(payload, 'application/xml')]]></ee:set-payload>
</ee:message>
</ee:transform>
<sharepoint:file-move doc:name="File move" doc:id="2d604ac1-4d33-4e61-8310-9d59671fe9c1" config-ref="Sharepoint_Sharepoint_online" fileServerRelativeUrl="#[payload.ServerRelativeUrl]"/>

但是我不确定新的文件服务器应该是什么?

在我的YAML文件中,我将存档路径存储如下
# Sharepoint
sharepoint:
siteUrl: "https://XXXXXXXX.sharepoint.com/sites/D365XXXXX"
auth:
username: "CCCCCC@abc.org"
password: "ABCDDD"
listener:
path: "/sites/D365Ad/NP Int/SF"
archive:
path: "/sites/D365Ad/NP Int/SF/Archive"
polling:
frequency: "60" # In seconds
startDelay: "30" # In seconds${sharepoint.archive.path}存储必须移动文件的归档文件夹路径。如果源文件名为XYZ,则需要将归档文件名设置为sourcefilename_datetime.xml,如何或在何处完成。任何帮助都是非常感谢的,因为这是我与Mulesoft的第一个项目。
发布于 2022-04-15 03:31:11
要在表达式中使用像${sharepoint.archive.path}这样的属性,请使用p()函数获取作为p("sharepoint.archive.path")的值。然后用文件名和时间戳将其连接起来。假设文件名存储在一个名为vars.filename的变量中
#[p("sharepoint.archive.path") ++ "/" ++ vars.filename ++ "_" ++ now() as String {format:"yyyyMMddTHHmmss"} ++ ".xml"]https://stackoverflow.com/questions/71873590
复制相似问题