Thursday, 14 August 2014

Pass Query string value from SharePoint Page to App Part

Steps:
1.Add Client web part to app part
2.Open  element.xml and add one Property
3.In the same element.xml file under Content you will find src, add your Property name

4.Go to host web where you are having query string
5.Add App part
6.Add one script editor web part. It should be below to App.
7.In the script editor web part, read query string and write some js code to read iframes and replace your PropertyValue with query string value.(Since we updated Content src with Property in element.xml, that Property will be available in iframe of app part).

8.Now in the App landing page load read the iframe code(Your query string value will be there with property="123" in the iframe). You can try with document.referrer and find your Property.
Use this value across the App.