📌 Use Case
In this use case, we are building an integration in Oracle Integration Cloud (OIC) that:
- Downloads a file from a File Server.
- Uploads that file to a specific SharePoint folder using Microsoft Graph API.
This is especially helpful in scenarios where enterprises manage data exports on file servers and want to automate data archival or sharing via SharePoint.
⚙️ Solution Design Overview
The integration follows these main steps:
- Trigger – A scheduled or REST-based trigger initiates the process.
- Fetch Site ID – Retrieves SharePoint Site ID using the server-relative path.
- Fetch Drive ID – Retrieves the Drive ID associated with the Site.
- Download File – Reads the file from the file server.
- Upload File – Uploads the file to SharePoint using Microsoft Graph API PUT call.
🔍 Step-by-Step Solution
✅ Step 1: Get SharePoint Site ID
- REST Endpoint Name:
GetSiteID
- Method: GET
- Relative URI:
/sites/{tenant}.sharepoint.com%3A/sites/{server-relative-path}
- Response Sample:
{ "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#sites/$entity", "createdDateTime": "2022-09-26T07:22:04.923Z", "description": "sp_org_app_DWCSSystemIntegration_qa", "id": "yourtenant.sharepoint.com,c87b311d-f1f0-4576-9f43-256b0366ccd4,315734c4-892c-486f-8901-5c8827144a16", "lastModifiedDateTime": "2024-08-23T11:25:16Z", "name": "sp_org_app_DWCSSystemIntegration_qa" }
✅ Step 2: Get SharePoint Drive ID
- REST Endpoint Name:
GetDriveID
- Method: GET
- Relative URI:
/sites/{siteId}/drives
- Query Parameter:
$filter = name eq '<folder_name>'
- Site ID is dynamically extracted from the previous response using an XSL mapping.
🧠 Conditionally Construct Filter Query:
- Use
substring-before()
ifparentpath
has/
- Else use as is
Sample response:
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#drives",
"value": [
{
"id": "b!0mFabc12345def6789ghiJKLmnopQRSTuvwxYZaBCDE",
"driveType": "documentLibrary",
"name": "Documents",
"webUrl": "https://yourtenant.sharepoint.com/sites/testsite/Shared%20Documents",
"createdDateTime": "2023-04-20T10:30:00Z",
"lastModifiedDateTime": "2024-03-15T08:45:00Z",
"createdBy": {
"user": {
"displayName": "Admin User",
"id": "admin-user-id"
}
},
"lastModifiedBy": {
"user": {
"displayName": "Admin User",
"id": "admin-user-id"
}
}
},
{
"id": "b!9xYz321klmn456uvwXYZabcDEfghiJKLMNoPQrsTUv",
"driveType": "documentLibrary",
"name": "Shared Documents",
"webUrl": "https://yourtenant.sharepoint.com/sites/testsite/Shared%20Documents"
}
]
}
✅ Step 3: Download File from File Server
- Action: Use File Adapter with Native File System (FS)
- Read Mode: Binary
- Output: Stream Reference
✅ Step 4: Upload File to SharePoint
- REST Endpoint Name:
UploadFileToSharepoint
- Method: PUT
- Relative URI:
/drives/{driveid}/root:/{filename}:/content
- Payload Format: Binary
- Content-Type: Set as dynamic or static depending on file type
Example:text/csv
orapplication/octet-stream
🧩 Key Integration Design Elements
Component | Description |
---|---|
Trigger | REST or Schedule Trigger |
File Server | Native File Adapter |
SharePoint | Microsoft Graph API |
Mapping | Used to extract siteId, build filter, and construct headers |
Headers | Content-Type (optional but recommended) |
Payload | Binary Stream from File Adapter |
🛠️ Pre-requisites
- Microsoft Graph OAuth 2.0 Authentication configured in OIC
- SharePoint API permissions:
Sites.Read.All
Files.ReadWrite.All
- File server connection configured
- OIC connectivity agent if on-prem file server
📌 Conclusion
With this approach, you can automate file transfers between a File Server and SharePoint seamlessly using OIC. This design is scalable and allows for dynamic path and filename handling, making it robust for real-world enterprise use cases.
Implementation screenshots:
Trigger:
No comments:
Post a Comment