mercredi 11 mars 2015

Help deploying AppPart, can't get the document.URL in Javascript



I built on VS 2012 a Provider-hosted App project for Sharepoint 2013. The goal is to be able to show my App "UI" through a SharePoint page content. For instance, in my case, I would add a Web Part to a SP page, and this webpart would be a "window" showing my app content. The said-content is here a slideshow (HTML/JS) populated by a SP List.


My solution is basically composed of 2 projects :



  • A SP App project

  • A Web App project (which is a needed when making a provider-hosted app)


My projects are composed like this : Project Tree


In the App project : I've added a Webpart, in order to manage properties of my app, and see it wherever I want on my SP site.


the App.js is my App script, App.css stylesheet for the presentation, and Default.aspx, the HTML markup. Note that I use jQuery in my App.js.


In the Web App project : I've added an aspx page, to display my test properties values.


Both of my projects assembly is signed with the same .snk key.


Configuration : In DiaporamaWebApp, into the "Web" tab, I've set a specific page "AppPartContent.aspx" as a starting action. In the sever part,I checked the option to use local IIS Web server.


In the DiaporamaApp manifest, I gave it the read rights for lists ans site. Query string left to "{StandardTokens}" and my starting page is "Pages/Default.aspx".


The VS 2012 is correctly linked to my SP site. When I debug (F5) it open 2 windows (one for each project) and throw me an error in my AppPartContent.aspx JS code :


when parsing the params :



var params = document.URL.split("?")[1].split("&");


the debbuger tell me that it can retrieve split value from a null element. document.URL return a null value, and I don't get why. Maybe it's not even the only problem, that's why I explained my whole project, if someone could give me a hand into the way to follow while creating such an application.


I'm also fed up with the microsoft documentations and tutos which is incompletes, incorrect sometimes, that made me lost a huge amount of time.


Thanks for yours anyway,








0 commentaires:

Enregistrer un commentaire