简体   繁体   中英

How can I send query parameters from SharePoint 2013 page to SharePoint App Web Part in autohosted app?

As the title suggests, I have an AutoHosted SharePoint 2013 application. I have built a Web Part that can be added to a SharePoint page.

I want to be able to pass query parameters from the parent page to my sharepoint web part app. I just can't seem to figure out how to listen for query parameters from my web part.

What I am trying to do: mycompany.sharepoint.com/sites/mypage.aspx?variable=ContentIWant

I have a WebPart added to 'mypage.aspx' and I can't seem to be able to get the content from the 'variable'.

In C# on my app, I am outputting the following, but it does not output get parameters from the parent page.

foreach(string key in Request.Form.Keys ) {
     Response.Write ( Request.Form[key] );   
}

foreach(string key in Request.QueryString.Keys ) {
     Response.Write ( Request.QueryString[key] );
}

As you can see I am doing both POST and GET variables in the hope of finding something useful.

Has anyone ever tried to do what I am doing, and if so? Any advice or code samples?

I have kind of the same problem.

You can see my current "hacky" javascript solution here: Use Sharepoint querystring value as App-part property

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM