Hi All,
I've been chasing my tail on this for a week now and have not figured it out. I'm doing a search by file name and getting the results using the line of code below. Now that I have the file/files is there no way to get a UDP from here? I've read every blog and search through this message board relentlessly. Although I admit not everything I've read have I understood.
We have a custom property call "Description" and I just want to get the value of the property. Can someone PLEASE help?
Thanks in advance!
Dim
files AsFile() = mgr.DocumentService.FindFilesBySearchConditions(NewSrchCond() {Srch}, Nothing, Nothing, False, True, bookmark, status)
Solved! Go to Solution.
Solved by Balaji_07. Go to Solution.
Hi Mike,
Try this, Hope you don't need any description for the code 😉 Cheers!
Dim filepropDefIds As New List(Of Long)
Dim props() As PropDef = ServiceManager.PropertyService.GetPropertyDefinitionsByEntityClassId("FILE")
Dim filepropDefIds() = (from prop in props
where prop.DispName.Equals("Description",StringComparison.InvariantCultureIgnoreCase).Equals(true)
select prop.Id).ToArray()
If filepropDefIds isnot Nothing
Dim _coPropInst() as PropInst = adminServiceManager.PropertyService.GetProperties("FILE", new long() { _file.Id }, _filepropDefIds)
Dim value as String = _coPropInst(0).Val
End If
Regards,
Balaji A
Worked great! I had to tweek some stuff, but it did the job. I don't understand all of it, but that's not new for me. LOL
Below is your tweeked code.
Thanks!!!!!
Dim props() AsPropDef = mgr.PropertyService.GetPropertyDefinitionsByEntityClassId("FILE")
Dim filepropDefIds() AsLong = (From prop In props Where prop.DispName.Equals("Description", StringComparison.InvariantCultureIgnoreCase).Equals(True) Select prop.Id).ToArray
If filepropDefIds IsNotNothingThen
Dim _coPropInst() AsPropInst = mgr.PropertyService.GetProperties("FILE", NewLong() {files(0).Id}, filepropDefIds)
Dim value AsString = _coPropInst(0).Val
EndIf
Hi Mike,
The code which you have provided (thanks for that!) gives me an error: Error 1 Value of type 'Long' cannot be converted to '1-dimensional array of Long'.
Any idea how I can resolve this?
Below is the code I'm using.
'Get File ID Dim FileID As Long = CLng(assoc.CldFileId) 'Get PropertyDef ID Dim props() As PropDef = m_serviceManager.PropertyService.GetPropertyDefinitionsByEntityClassId("FILE") Dim filepropDefIds() As Long = (From prop In props Where prop.DispName.Equals("Revision", StringComparison.InvariantCultureIgnoreCase).Equals(True) Select prop.Id).ToArray If filepropDefIds IsNot Nothing Then 'Get propertyDef value Dim _coPropInst As PropInst = m_serviceManager.PropertyService.GetProperties("FILE", FileID, filepropDefIds)'This rule generates the error Dim FileRev As String = _coPropInst(0).Val
Thanks
Danny
This did the trick:
Dim PropInsts() AsPropInst = m_serviceManager.PropertyService.GetProperties("FILE", NewLong() {FileID}, NewLong() {filepropDefIds(0)})
Thanks Mike for your reply.
Danny