Community
I'd like to get the folder ID from a full Vault path. I'm currently using FindFolderBySearchConditions and that did not work when I feed it a full path. Below is an example of the folder path I'd like to get the ID for and the current code I'm using.
$/Designs/Reference Parts
Function Get_Folder_ID(FolderPath As String) As Long()
Dim mVltCon As VDF.Vault.Currency.Connections.Connection = VB.ConnectionManager.Instance.Connection
If mVltCon Is Nothing Then Return Nothing
Dim FolderPropsDef As ACW.PropDef() = mVltCon.WebServiceManager.PropertyService.GetPropertyDefinitionsByEntityClassId("FILE")
Dim ACWNamePropDef As ACW.PropDef = FolderPropsDef.[Single](Function(n) n.SysName = "Name")
'Set search options, opereator 3 is exact
Dim NameSearch As New ACW.SrchCond() With {
.PropDefId = ACWNamePropDef.Id,
.PropTyp = ACW.PropertySearchType.SingleProperty,
.SrchOper = 3,
.SrchRule = ACW.SearchRuleType.Must,
.SrchTxt = FolderPath
}
Dim bookmark As String = String.Empty
Dim status As ACW.SrchStatus = Nothing
Dim results As ACW.Folder() = mVltCon.WebServiceManager.DocumentService.FindFoldersBySearchConditions(New ACW.SrchCond() {NameSearch}, Nothing, Nothing, False, bookmark, status)
Dim id As Long() = {results(0).Id}
Return id
End Function
Solved! Go to Solution.
Solved by ericbouwkamp. Go to Solution.
Thanks for pointing that out. I was able to make that function much smaller and robust with that command.
Function Get_Folder_ID(FolderPath As String) As Long()
Dim mVltCon As VDF.Vault.Currency.Connections.Connection = VB.ConnectionManager.Instance.Connection
If mVltCon Is Nothing Then Return Nothing
Dim results As ACW.Folder() = mVltCon.WebServiceManager.DocumentService.FindFoldersByPaths(New String() {FolderPath})
Dim id As Long() = {results(0).Id}
Return id
End Function
Can't find what you're looking for? Ask the community or share your knowledge.