locked
Server side code in SharePoint hosted App. RRS feed

  • Question

  • Hi All,

    Is there any way to have server side code in SharePoint hosted App? What to do if i need to deploy following artifacts in sharePoint hosted apps.

    • Event Receiver.
    • Application pages.
    • Use out of the box webpart i.e. data view webpart.
    • Visual webpart.
    • Custom Workflow (visual studio workflow)
    • Custom webpart.

    Regards Amit


    Tuesday, June 4, 2013 3:12 AM

Answers

  • SharePoint-Hosted apps runs within the context of the client, that means the browser. That also means it can only contain pure html, css and javascript code. So based on that fact, it's tecnically impossible to implement the artifacts you are listing above. After all,  one of main reasons for introducing the app model was to avoid use of custom code  that accessed the server object model directly.

    If your requirement is to use the compoments above, you need a solution, not an app.


    Kind Regards

    Bjoern
    http://www.sharepointviking.com
    Twitter: Follow @bjoern_rapp

    Tuesday, June 4, 2013 1:29 PM

All replies

  • SharePoint-Hosted apps runs within the context of the client, that means the browser. That also means it can only contain pure html, css and javascript code. So based on that fact, it's tecnically impossible to implement the artifacts you are listing above. After all,  one of main reasons for introducing the app model was to avoid use of custom code  that accessed the server object model directly.

    If your requirement is to use the compoments above, you need a solution, not an app.


    Kind Regards

    Bjoern
    http://www.sharepointviking.com
    Twitter: Follow @bjoern_rapp

    Tuesday, June 4, 2013 1:29 PM
  • Hi All,

    Is there any way to have server side code in SharePoint hosted App?

    Hi Amit,

    No, basically there is no option to perform server side coding in Apps for SharePoint in a SharePoint Hosted environment. You either need to perform your actions through Client Side Object Model CSOM or REST interfaces but even by doing so this might hit some limitations if you are not an authenticated (anonymous) user.

    Hope it helped,

    Maarten


    Software Engineer * MVP-Visual Developer-VSTO

    Tuesday, June 4, 2013 9:00 PM
  • With sharepoint hosted apps - you can only use JSOM ( javascript object model ) and REST - which will run in the context of either app or the user accessing the app - depending on what permission set you settle on.

    For anything else ( CSOM / C# ) you need to use either provider hosted / autohosted using the cloud.

    event receiver  = remote event receiver = auto hosted or provider hosted
    application pages is not possible - but you can use app pages instead with auto hosted or provider hosted
    Visual webpart = app parts
    Custom webpart = app parts

    Not sure in regards to workflows.

    Regards,
    Ole

    Tuesday, June 4, 2013 11:05 PM
  • Hi ,

    As all others said its not possible to implement above functionalities in Sharepoint Apps. However in Provide hosted app you could use WCF Service hosted in Sharepoint, to use server side code for implementing above scenerios.


    Abu Shaeeb

    • Proposed as answer by Abu Shaeeb Monday, February 10, 2014 10:03 AM
    Friday, January 17, 2014 12:58 PM