My new years' resolution for 2015 is to complete my resolution from 2014, which is to make sure I post more often on my blog which I continued in 2013 that I started in 2012!!
So, without further ado .. here goes!!
As part of a recent deployment, I was asked to copy a specific report (or maybe even a group of reports) to the 'My Folders' of multiple users.
There are two ways around this.
So, without further ado .. here goes!!
As part of a recent deployment, I was asked to copy a specific report (or maybe even a group of reports) to the 'My Folders' of multiple users.
There are two ways around this.
- Create the report under the [Public Folders], provide the path to the report to the end users, and ask them to copy it to their [My Folders].
- If you want something done right, do it yourself!!
Now, we know how *ahem* efficient users can be when asked to perform certain tasks. Some had updated versions of the report because they followed the instructions, and the rest, obviously didn't.
Vox populi not working well in this situation? Probably.
I pulled up a small script to copy the new report from one source path to multiple destinations. Obviously, one would have to call this code multiple times based on the destination.
Few important pointers.
Try
' Interesting to note that the source search path is an object of type searchPathMultipleObject.
' This shows that multiple source objects can be copied
Dim spmo As New searchPathMultipleObject
spmo.Value = sourceSearchPath
Dim bcrpt() = m_CMS.query(spmo, GetAllPropsList, New sort() {}, New queryOptions)
' Destination search path is an object of type searchPathSingleObject.
' The logic would be that multiple source objects can be copied to a single destination
Dim spso As New searchPathSingleObject
spso.Value = destinationSearchPath
Dim co As New copyOptions
co.updateAction = updateActionEnum.replace
co.recursive = True
m_CMS.copy(bcrpt, spso, co)
LogWriter("Report " & reportName & " copied from " & sourceSearchPath & " to " & destinationSearchPath)
Return True
Catch ex As Exception
LogWriter("Error in copy report: " & ex.Message)
Return False
End Try
Vox populi not working well in this situation? Probably.
I pulled up a small script to copy the new report from one source path to multiple destinations. Obviously, one would have to call this code multiple times based on the destination.
Few important pointers.
- sourceSearchPath is a string variable with the path of the folder where the source report exists. NOTE: Report Name should NOT be in the sourceSearchPath
- GetAllPropsList is a function that returns ALL properties
- destinationSearchPath is a string variable with the path of the destination folder
Try
' Interesting to note that the source search path is an object of type searchPathMultipleObject.
' This shows that multiple source objects can be copied
Dim spmo As New searchPathMultipleObject
spmo.Value = sourceSearchPath
Dim bcrpt() = m_CMS.query(spmo, GetAllPropsList, New sort() {}, New queryOptions)
' Destination search path is an object of type searchPathSingleObject.
' The logic would be that multiple source objects can be copied to a single destination
Dim spso As New searchPathSingleObject
spso.Value = destinationSearchPath
Dim co As New copyOptions
co.updateAction = updateActionEnum.replace
co.recursive = True
m_CMS.copy(bcrpt, spso, co)
LogWriter("Report " & reportName & " copied from " & sourceSearchPath & " to " & destinationSearchPath)
Return True
Catch ex As Exception
LogWriter("Error in copy report: " & ex.Message)
Return False
End Try
No comments:
Post a Comment