Mulesoft Sharepoint 文件移动连接器

Mulesoft Sharepoint File move connector

我正在尝试构建一个 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]"/>
    

但我不确定新文件服务器相对 url 应该是什么

在我的 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

的第一个项目

要在表达式中使用类似于 ${sharepoint.archive.path} 的 属性,请使用 p() 函数获取值为 p("sharepoint.archive.path")。然后将它与文件名和时间戳连接起来。假设文件名存储在名为 vars.filename:

的变量中
#[p("sharepoint.archive.path") ++ "/" ++ vars.filename ++ "_" ++ now() as String {format:"yyyyMMddTHHmmss"} ++ ".xml"]