Skip navigation
jsong@highvista
Currently Being Moderated

JSObject error in c# reflection

Jul 11, 2012 12:06 PM

hello,

I'm using c# and Javascript object to do some pdf manipulation. Please see the below code, I ran into an "Unknown Name" error at the last line when trying to get the "children" object from the BookmarkRoot. Getting the "name" and "color" worked fine, but I don't know why I'm getting the "unknown name" error for the "children". Am I missing something? any suggestions?

 

object jsObj = pdfFinal.GetJSObject();

object bmr = jsObj.GetType().InvokeMember(

            "bookmarkRoot",

            System.Reflection.BindingFlags.GetProperty,

            null, jsObj, null);

object name = bmr.GetType().InvokeMember("name",

            System.Reflection.BindingFlags.GetProperty,

            null,bmr,null);

object color = bmr.GetType().InvokeMember("color",

            System.Reflection.BindingFlags.GetProperty,

            null, bmr, null);

//the below line gives Unknown name. (Exception from HRESULT: 0x80020006(DISP_E_UNKNOWNNAME))

object children = bmr.GetType().InvokeMember("children",

            System.Reflection.BindingFlags.GetProperty,

            null, bmr, null);

 

 

Thanks,

John

 
Replies

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points