Created
December 5, 2013 23:10
-
-
Save craibuc/7815730 to your computer and use it in GitHub Desktop.
Use the BusinessObjects SDK to copy files between two InfoObjects. This is useful when the source is a ‘template’ object (e.g. Crystal Report) that will be deployed to one or more targets.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'get the source and target infoObjects | |
| Dim sourceInfoObject As InfoObject = infoStore.Query("SELECT SI_ID, SI_NAME, SI_FILES FROM CI_INFOOBJECTS WHERE SI_ID=" & sourceId)(1) | |
| Dim targetInfoObject As InfoObject = infoStore.Query("SELECT SI_ID, SI_NAME, SI_FILES FROM CI_INFOOBJECTS WHERE SI_ID=" & targetId)(1) | |
| 'get the desired file from FRS | |
| Dim sourceFile As File = sourceInfoObject.Files(1) | |
| 'create buffer and size appropriately | |
| Dim buffer As Byte() = new Byte(sourceFile.Size) {} | |
| 'copy file to buffer | |
| sourceFile.CopyTo(buffer) | |
| 'get the target file from the FRS, using the same index as the source | |
| Dim targetFile As File = targetInfoObject.Files(sourceFile.NthFile) | |
| 'copy buffer to target file | |
| targetFile.Overwrite(buffer) | |
| 'save to repository | |
| targetInfoObject.Save |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment