-2

I want to convert object to Idfdocument in VB.NET

 Id = m_DfClientX.getId(itemID)
'itemID string
If (Id IsNot Nothing) Then
sysObj = CType(session.getObject(Id), IDfSysObject)
nesne = sysObj.getContent()

Dim doc As IDfDocument = CType(nesne, IDfDocument) 

Exception

Exception is:'System._Object' türündeki COM nesnesi 'DFCLib.IDFDocument' arabirim türüne atanamadı. '{EFAC2D68-175B-9927-006097C27C31}' IID'sine sahip arabirim için COM bileşenindeki QueryInterface çağrısı aşağıdaki hatayla başarısız olduğundan bu işlem başarısız oldu. Böyle bir arabirim desteklenmiyor. (HRESULT özel durum döndürdü:0x80004002 (E_NOININTERFACE)).

Miki
  • 2,493
  • 2
  • 27
  • 39
  • Your stacktrace is in Turkish, or something like it, it's not readable enough... – Miki Nov 06 '14 at 08:11
  • I'm trying to write code in vb.net program. I've got java code, but I'm having trouble converting the vb.net – Demet Özturan Nov 06 '14 at 09:01
  • Exception is: 'system._object' COM object of type 'dfclib.ıdfdocument' could not be assigned to the interface type. '{EFAC2D68-175B-9927-006097C27C31}' QueryInterface call on the COM component for the interface with IID failed this process fails with the following error. Such an interface is not supported. (Exception from HRESULT returned: 0x80004002 (E_NOININTERFA ACE)). – Demet Özturan Nov 06 '14 at 09:02
  • I want to; object type convert to IDFDocument type. so: Dim obj As Object = Nothing sysObj = CType(session.getObject(Id), IDfSysObject) obj = sysObj.getContent() Dim doc As IdfDocument= obj *Exception line ***For Example C# or Java >> IDfSysObject sysObject = (IDfSysObject) session.getObject(id); I question is; how to use (**) in vb.net – Demet Özturan Nov 06 '14 at 11:26
  • it is smart way to edit the question since than other people that come later can understand it more easily. I removed my irrelevant comments since you provided more info in your comments. It is the best that you update your question added this info in it and deleting unnecessary comments too – Miki Nov 06 '14 at 13:00

1 Answers1

1

I don't think its smart way to acquire id object from dfc client object, but if you do it that way than you can have this code:

Dim session As IDfSession
Dim persistantObject As IDfPersistentObject
Dim idfdocumentObject As IDfDocument

'Acquiring session
Set session = Nothing
Set session = dctm.GetSession

'getting object
Set persistantObject = session.getObject(Id)

'casting
Set idfdocumentObject = persistantObject 

If you have id as string than you can use this way to acquire your object:

session.getObjectByQualification("dm_document where r_object_id = '" + itemIdString + "'")
Miki
  • 2,493
  • 2
  • 27
  • 39