Hi,
Question is in topic - has anybody found opportunity to run EPDM template with API? Any other options?
Thanks in advance!
Best,
Wojciech
Hi,
Question is in topic - has anybody found opportunity to run EPDM template with API? Any other options?
Thanks in advance!
Best,
Wojciech
Geir,
I ran across your entry today and wondered if you or someone else might be able to point me to some documentation or help.
I'm using code similar to yours above to create folders from a template. The code works as expected most of the time. However, when the folder being created already exists, I get no error indication back. My guess is that there is some information loaded into this "retData" array that would tell me that the folder already exists but I can't find anywhere in the PDM documentation about what this array has in it or how it is structured. Do you know where I can find out?
Thanks,
David
Hello David,
Try to debug your code with something like this:
' Execute the template
Dim retData() As System.Object
'or...Dim retData As Array = Array.CreateInstance(GetType(EdmData), 1)
Dim refreshFlag As Long
refreshFlag = temp.RunEx(0, _folder.ID, retData)
Dim myData As EdmData
Dim idx As Long
idx = LBound(retData)
Dim upper As Long
upper = UBound(retData)
While idx <= upper
myData = retData(idx)
Select Case myData.Type
Case EdmDataType.EdmData_File
Debug.Print("Type=File, Path=" + myData.Get(EdmDataPropertyType.EdmProp_Path))
Case EdmDataType.EdmData_Folder
Debug.Print("Type=Folder, path=" + myData.Get(EdmDataPropertyType.EdmProp_Path))
Case EdmDataType.EdmData_Variable
Debug.Print("Type=Variable, Name=" + myData.Get(EdmDataPropertyType.EdmProp_Name) + ", Value=" + myData.Get(EdmDataPropertyType.EdmProp_Value))
Case Else
Debug.Print("Unknown data type")
End Select
idx = idx + 1
End While
GeirDa!
Hello Wojciech,
You can try this code:
Sub RunTemplate(ByVal _vault As IEdmVault5, ByVal _folder As IEdmFolder5, ByVal _templateName As String)
' Get the template manager IEdmTemplateMgr5
Dim tempMgr As IEdmTemplateMgr5
tempMgr = _vault
' Find the template with the specified name
Dim pos As IEdmPos5
pos = tempMgr.GetFirstTemplatePosition
Dim temp As IEdmTemplate53 = Nothing
Dim foundIt As Boolean
foundIt = False
While (Not pos.IsNull) And (Not foundIt)
temp = tempMgr.GetNextTemplate(pos)
If temp.GetMenuString = _templateName Then
foundIt = True
End If
End While
If Not foundIt Then Exit Sub
' Execute the template
Dim retData() As System.Object ' EdmData
Dim refreshFlag As Long
refreshFlag = temp.RunEx(0, _folder.ID, retData)
End Sub
GeirDa!