3

I have a web part that will render an existing report on Report Server. The way I found to do this, is to render the report in a App Part using <iframe/> and then reference the App Part in a web part using <Content Type="html" Src="~appWebUrl/Pages/Default.aspx" />. However I will need to access the web part properties from the javascript. I'm trying to see if this is possible by using this function with a breakpoint on the 3rd line just to check if we were able to pull the properties:

function getWebPartProperties() {
    var object = $('#gordoWebPart');
    var properties = object.get_properties();
    var properties2 = object.get_properties();
}

And I'm referencing this script in my App Part using <script type="text/javascript" src="../Scripts/App.js"></script>. The problem is that even though I can see the App.js loaded in my App Part (using IE developer tools), I can't see the script loaded on my web part.

Am I registering the script in the wrong way? How should I approach this?

1 Answer 1

1

You need to use querystrings to get the webpart properties, as used in this example:

<Content Src="~remoteAppUrl/AppPartContent.html?strProp=_strProp_&amp;intProp=_intProp_&amp;boolProp=_boolProp_&amp;enumProp=_enumProp_"
        Type="html"/>

Then you can get that from your javascript: http://www.joezimjs.com/javascript/3-ways-to-parse-a-query-string-in-a-url/

Have a look at this article, I have extracted the code from there: http://msdn.microsoft.com/en-us/library/office/fp179921(v=office.15).aspx

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.