SharePoint Add-Ins, though very interesting, are very tricky. Let me get directly to the point. If you are developing a SharePoint Hosted add-in, that needs to make a call outside the app web, be it host web or any other API call, there are certain things that need to be completed. Otherwise, you will have everything in place but will keep producing the Error-Not Found message when you run your SharePoint hosted add-in.

Understanding the Error Message:

This error will be produced when your Add-In cannot find the targeted list or any other SharePoint component that is being targeted in an App web or Host Web.

App Web: It is a web of app, that is, the web which is accessible to the app after it starts executing.

Host Web: It is a web of the host which is executing or which invokes execution of the app.

Cross-domain calls:

Let me give example of my application, when I encountered this issue.

In my application I am making call to user profiles in O365, for that purpose I needed my application to access UserProfile API and get back the results. This is how, it worked:

ScriptBase= HostWebUrl + "/_layouts/15/";

// Execute SP.RequestExecutor.js before your function executes

$.getScript(ScriptBase + "SP.RequestExecutor.js", execCrossDomainRequest);

// Execute Cross Domain Call function

function execCrossDomainRequest() {

var context1 = new SP.ClientContext(AppWebUrl);

try {

var factory = new SP.ProxyWebRequestExecutorFactory(AppWebUrl);


catch (err) {




var appContextSite = new SP.AppContextSite(context1, HostWebUrl);

this.web = appContextSite.get_web();


var executor = new SP.RequestExecutor(AppWebUrl);



url: AppWebUrl + "/_api/SP.AppContextSite(@target)/web/sitegroups/GetByName(GroupName)/users?@target='" + encodeURIComponent(HostWebUrl) + "'",

method: "GET",

crossDomain: true,

headers: { "accept": "application/json; odata=verbose" },

success: successHandler,

error: errorHandler



// Success Handler function

function successHandler(data)


var Parser= Json.Parse(data.body);



// Error Handler function

function errorHandler(data, errorcode, errormessage) {

alert("Error:" + errormessage);


Using the example above, you can make cross domain calls and tackle the famous "Not Found" error. Enjoy coding!

For more information about this blog or C5 Insight, please Contact Us!