繁体   English   中英

如何使用IronPython脚本在Spotfire库中创建文件夹

[英]How to create a folder in Spotfire Library using IronPython script

我想在Spotfire库中创建一个文件夹,并使用IronPython脚本保存分析文件。 但是我不确定如何在Library Manager的create folder函数中传递LibraryItem。

您需要使用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())

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM