none
Developing SharePoint Hosted Apps with Custom List - Confusing... RRS feed

  • Question

  • Hi,

       I've opened a Visual studio 2013 and created sharepoint hosted apps. And created sitecolumns, content types and custom list in the project. After clicking f5, it opened host web, and then after clicking app icon, it is redirecting to app web and showed my lists. But, my requirement is,when the end user open the portal, it should automatically redirect to appweb with my lists. Or, I need to create a app solution not farm solution, and the solution should provision all items after install it. When end user open the site, it should open the list with my branding master page. Please suggest me how to achieve this. My end user doesn't know what is app? If he click the url we need to open the list form to enter the data.


    Balaji -Please click mark as answer if my reply solves your problem.


    • Edited by balaji_rcs Sunday, May 17, 2015 9:52 AM
    Sunday, May 17, 2015 9:51 AM

Answers

  • Hi Balaji,

    From your description, my understanding is that you want to your end users can access your app list when they open the portal.

    You should set your app list as the default page of the app for reference:

    http://www.sharepoint-journey.com/sharepoint-list-in-sharepoint-hosted-app.html

    After you set your app list as the default page and deploy the app, please add this code below in your portal, it will redirect to your app directly:

    var id;
    
    var ctx = new SP.ClientContext.get_current();
    
    var web = ctx.get_web();
    
    var appInstances = SP.AppCatalog.getAppInstances(ctx, web);
    
    ctx.load(appInstances);
    
    ctx.executeQueryAsync(
    
      function () {
    
                      var e =  appInstances.getEnumerator();
    
               while (e.moveNext()) {
    
                    var app = e.get_current();
    
                    // replace your app title with my app title "SharePointApp7"
    
                    if (app.get_title() == "SharePointApp7") {
    
                        id = app.get_id().toString();
    
                        // replace your sharepoint site
    
                        var appUrl = "https://your site url/_layouts/15/appredirect.aspx?instance_id={"+id+"}"
    
                                                                                    window.open(appUrl,"_self");
    
                        break;
    
                    }
    
               }
    
      } , 
    
      function (sender, args) {
    
          console.log(JSON.stringify(args));
    
      });
    
    </script>
    

    Best Regards,

    Vincent Han


    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.


    Thursday, May 21, 2015 11:26 AM
    Moderator