Pass Query string value from SharePoint Page to provider hosted app in SharePoint 2013

In the new SharePoint App model, web parts are replaced with app parts. The problem is they don’t have an equivalent to Web Part Connections. So how can you pass parameters from one part to another?

To answer this you have to consider several things:

App parts are basically small applications that are presented in your SharePoint site through iframes.

Each app is running in a separate domain and so are their app parts. Because of this any direct manipulation through some javascript code is out of the question because it would mean cross-domain scripting and all you would get is an “access denied” message

This post explains how to create a user-defined custom property for a Client Web Part in SharePoint 2013 Provider Hosted App and its relationship with the query string and the standard tokens. The option for getting the data from Client Web Part’s custom property is a bit different from Farm based or Sandboxed Web Parts.

In the Provider Hosted App, the value of the property has to be accessed via the query string.

Steps:

Add Client web part to app part

Open element.xml and add one Property right-click on Client web part ->Custom properties.

Pass Query string value from SharePoint Page to provider hosted app in SharePoint 2013

Go to host web where you are having the query string

Add App part

Add one script editor web part. It should be below to App.

Pass Query string value from SharePoint Page to provider hosted app in SharePoint 2013

Now in the App landing page load read the Query string value in .Cs file

protected void Page_Load(object sender, EventArgs e)
{
string _ID = Request.QueryString["ID"];
}

You may like following SharePoint tutorials:

Here, we learned how to Pass Query string value from SharePoint Page to provider hosted app in SharePoint 2013.

free sharepoint training

SharePoint Online FREE Training

JOIN a FREE SharePoint Video Course (3 Part Video Series)

envelope
envelope

Sagar Pardeshi

I am Developer working on Microsoft Technologies for the past 6+years. I am very much passionate about programming and my core skills are SharePoint, ASP.NET & C#,Jquery,Javascript,REST. I am running this blog to share my experience & learning with the community I am an MCP, MCTS .NET & Sharepoint 2010, MCPD Sharepoint 2010, and MCSD HTML 5,Sharepoint 2013 Core Solutions. I am currently working on Sharepoint 2010, MOSS 2007, Sharepoint 2013,Sharepoint 2013 App Dev, C#, ASP.NET, and SQL Server 2008.

>