我想在Spotfire Library中创建一个文件夹,并使用IronPython脚本保存分析文件。但是我不确定如何在Library Manager的create folder函数中传递LibraryItem。
答案 0 :(得分:0)
您需要使用LibraryManager.TryGetItem方法选择父文件夹,然后将该文件夹和新文件夹名称传递给LibraryManager.CreateFolder方法。
这对我有用: -
# Import namespaces
from Spotfire.Dxp.Framework.Library import *
libraryManager = Document.GetService(LibraryManager)
parentFolder = '/path/parentFolder/'
newSubFolder = 'newSub'
parentFolderExists, folder = libraryManager.TryGetItem(parentFolder, LibraryItemType.Folder)
if parentFolderExists:
subfolderExists, subfolder = libraryManager.TryGetItem(customer + newSubFolder + '/', LibraryItemType.Folder)
if not subfolderExists:
print customer
libraryManager.CreateFolder(folder, newSubFolder, LibraryItemMetadataSettings())