I am trying to SaveAs a document as a library item on 'onPropertyChange' event using ironpython script. the script`s code attached to the property :
# Import namespaces
from Spotfire.Dxp.Application import DocumentSaveSettings
from Spotfire.Dxp.Framework.Library import *
# Set the folder path and file name
folderName = "/Spotfire Test Folder/Reports"
fileName = "Test File"
# Set up the LibraryMangager and ensure that we can
# access the folder path specified
libraryManager = Document.GetService(LibraryManager)
success, libraryFolder = libraryManager.TryGetItem(folderName, LibraryItemType.Folder)
# Embed the data
Document.Data.SaveSettings.EmbedAllSourceData = 1
# Save the document back to the Library
Application.SaveAs(libraryFolder, fileName, LibraryItemMetadataSettings(), DocumentSaveSettings())
Unfortunately, I get the following error :
Invalid operation 'BeginAggregatedTransaction' to the command history when in state 'Executing'
- Is there a problem with the script ? in case not , is there a way to save as a library item using a script or an api function (via javascript or ironpython)?