3

I am facing an intresting question... I want to create an Client Web Part but should be published by a Provider Hosted App. This Client Web Part should only be a button that hits a HTML page that will get data from an external web service.

But when I am creating a new Provider Hosted App I need to chose from between a classic ASP.NET application or MVC application, while I just want a web part. Nothing fancy.

It is a common standard for that company I have to do it for. How do I do this without creating a full blown page and where a button resides.

Thanks

  • Why can't you use a SharePoint-hosted app? – eirikb May 17 '15 at 14:27
  • Eirik, this is the company governance policy. Everything outside SharePoint. – pipelinecache May 17 '15 at 15:13
  • 1
    @pipelinecache, even if you create a provider hosted app with a client webpart the client webpart will live in a SharePoint hosted part of the app (not outside SharePoint). That is how the model regarding apps work. – Robert Lindgren May 17 '15 at 15:32
  • Ahh yes I agree with you Robert, but the code resides outside SharePoint. – pipelinecache May 17 '15 at 16:46
3

You're creating a Provider Hosted app, e.i. you're creating an app where the functionality is running outside SharePoint.

The two options for which Visual Studio has build-in template support are ASP.NET Web Form and ASP.NET MVC, so it ask you to chose one of these.

Visual studio then creates a solution with two projects, one for the App and one for the "remote" site, based on the technology you selected.

If you don't want to code your app in ASP.NET, then nothing prevents you from deleting this second project and the code the "remote" site using any other technology.

But regardless of how you develop your app with a client web part you need to specify two pages (can be the same).

The app ALWAYS should have its <StartPage> pointing to a full web page, this could just be a page describing what the app does, but it should be there as the user might click the app in the listing of apps and not just use the Client Web Part.

The Client Web Part is also a web page that you should host somewhere, as it will only be a web page shown in an IFRAME.

  • Hi Per, thanks for the clarification. I've tried this... but all pages created are being added to the MVC/ASP.NET project, and not to the app Project. – pipelinecache May 17 '15 at 18:23
  • 1
    Yes that's what provider hosted means. The App itself is purely configuration. If you need any form for pages (and you always do) then you need somewhere to host these. That can either be in an AppWeb site created as part of a SharePoint hosted web or somewhere else e.i. Provider Hosted. – Per Jakobsen May 17 '15 at 19:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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