Cogniza | Business-Intelligence Specialists

Nov/09

12

BusinessObjects SDK: Copy one InfoObject's File to Another InfoObject

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.


'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

· ·

No comments yet.

Leave a Reply

 

<<

>>

Theme Design by devolux.nh2.me