How can a SharePoint 2013 App Part initiate a redirect in its parent host web?

We have created a custom AppPart in a provider hosted ASP.NET MVC application.

The App Part contains a search button. If the user clicks the search button inside the AppPart we would like a different SharePoint page to be displayed in the HostWeb.

Answers


You cannot do that currently and it would be a bad UX experience I believe. The app part is an Iframe that won't give you access to the hostweb page. AFAIK the only client side "message" that you can send to the container page is to request your app part to be resized but you won't be able to navigate the user to a different page. You can open a new window though.

http://msdn.microsoft.com/en-us/library/office/jj220046.aspx


You can use:

window.top.location.href = "url of SharePoint page" 

to redirect the user to the intended page. Note: If the page is part of app web, you might have to pass standardtokens also.


Although this is an old question, I hope this will help someone. The best option is to do the following:

<form action="http://myurl.com/search.aspx" target="_parent">
    [Your form]
    <input type="submit" value="Search" />
</form>

The target="_parent" will cause the redirect to be done in the parent site instead of within the iframe.


Need Your Help

Spark List control - 'n' key moves to next row

actionscript-3 flex flex4

I've created an editable list. It means I have an sparks:List with itemRenderes with TextInputs. When I type in text fields, the 'n' key moves selection to next list item. How to get rid of this ? ...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.