Pregunta

Didn´t find any information at google or at stackexchange for this topic. I wrote a sharepoint hosted app, which has a list. In default.aspx I get data from that list via Rest and have form to create new listitems. Works fine. I then added a Client Appart and adapted the code from default.aspx. After deploying that appart to my developersite, the REST GET is working fine and the items are rendered correctly. If I use the form to create a new item from that apppart, I got a 403 forbidden from list api. It´s the same REST POST as in default.aspx.

Is there something that technical that prevents the POST or do I have to use sp.requestexecutor? Thanks in advance for any suggenstions.

¿Fue útil?

Solución

found the solution to my problem. As Steve pointed out, it is possible that an AppPart posts to its own AppWeb. The 403 was generated because I tried to get the RequestDigest this way: $('#__REQUESTDIGEST').val(). This works perfectly in masterpages, eg default.aspx. In an AppPart Page there is no __REQUESTDIGEST, so I didn´t get the correct value. Know I pull the Digest with REST from _api/contextinfo. Works!

What led me in the wrong way, was that in fiddler I saw a RequestDigest. Now I know that even if you put nothing in it, you will see a "wellformed" Digest in the JSON Call.

Thanks to Steve for making clear that it is possible what encouraged me to look further!

Licenciado bajo: CC-BY-SA con atribución
scroll top