How to replace the content of the target file with the content from a different file.

This technique can for be used for uploading a file to SharePoint and making the actual file a dummy, by dynamically replacing the content uploaded.
(Anonymize file content or replace with template content)

The process is to assign the system parameter [<<FileTransportSourceFile>>] with the name of the file that contains the replacement content. Then the physical upload will then use that file instead of the “real” source file when reading the file content for the upload stream.

Static example 1
This will replace the file content for ALL files with the content from the file c:\templates\MyContent.docx


Dynamic example 2
In this example below the parameter [] will return the name of the file that holds the replacement content. In this case only files of type docx, xlsx, pdf will have the content replaced. All other file types will contain the content for the from the original source file.

Need more help with this?

Thanks for your feedback.