Is there a way to get all the lists in the subsites where the list is named 'Posts'? This gets the list if it is deployed on the subsite itself but not from the parent. The hostUrl looks like 'http://contoso/' I need it to look like 'http://contoso/site/blog', the AppPart will be deployed on the parent and I want it reusable so I can publish it to the local SharePoint Store.
var appUrl = GetUrlKeyValue("SPAppWebUrl"); var hostUrl = GetUrlKeyValue("SPHostUrl"); var url = appUrl + "_api/SP.AppContextSite(@target)/web/lists/getbyTitle('Posts')/items?" + "$select=ID,Title,Body,NumComments,Published&$orderby=Published&" + "@target='" + hostUrl + "'";