To upload documents from SharePoint to Azure Blob Storage while preserving their associated metadata, including the original SharePoint file URL, you can follow these steps:
- Retrieve Metadata from SharePoint: Since you mentioned that you can retrieve metadata using Logic Apps and Power Automate, continue using these tools to gather the necessary metadata, including the original SharePoint file URL.
- Upload Files to Azure Blob Storage: When you upload the files to Azure Blob Storage, you can use the Azure Blob Storage SDK or REST API. While uploading the files, you can set metadata for the blobs. This allows you to attach the original SharePoint file URL as metadata during the upload process.
- If you're using the Azure SDK, you can set metadata by specifying it in the upload method. For example, in C#:
var blobClient = new BlobClient(connectionString, containerName, blobName); var metadata = new Dictionary<string, string> { { "SharePointFileUrl", sharePointFileUrl } }; await blobClient.UploadAsync(fileStream, new BlobHttpHeaders { ContentType = contentType }, metadata);
- If you're using the Azure SDK, you can set metadata by specifying it in the upload method. For example, in C#:
- Using Azure Logic Apps or Power Automate: If you prefer to continue using Logic Apps or Power Automate, you can utilize the Azure Blob Storage connector, which allows you to set metadata when creating a blob. Make sure to include the metadata key-value pairs in the appropriate action.
- Verify Metadata: After uploading, you can verify that the metadata has been set correctly by retrieving the blob properties and checking the metadata section.
By following these steps, you should be able to upload your SharePoint files to Azure Blob Storage while preserving the original file URL as metadata, enabling your Agent to reference it in responses effectively.
References: