我正在尝试使用PowerShell通过其COM SDK与SAP的Universe设计工具(UDT)进行交互。
我成功获取/设置了根对象的属性:
# create UDT instance
$designer = New-Object -ComObject Designer.Application
# get the version
[System.__ComObject].InvokeMember("Version",[System.Reflection.BindingFlags]::GetProperty,$null,$designer,$null)
14.2.4.2410
# make UDT visible
[System.__ComObject].InvokeMember("Visible",[System.Reflection.BindingFlags]::SetProperty,$null,$designer,$true)
# quit UDT
[System.__ComObject].InvokeMember("Quit",[System.Reflection.BindingFlags]::InvokeMethod, $null, $designer, $null, $null, $null, $null)
但我似乎无法访问其他类和集合,特别是Universes集合:
# get a reference to the collection
$universes = [System.__ComObject].InvokeMember("Universes", [System.Reflection.BindingFlags]::GetProperty, $null, $designer, $null);
# open a file
$path = "c:\users\x\desktop\foo.unv"
$universe = [System.__ComObject].InvokeMember("Open", [System.Reflection.BindingFlags]::InvokeMethod, $null, $designer, $null, $null, $path);
对象浏览器中的类层次结构:
界面的成员:
Open
方法的签名:
我做错了什么?