0

Problem:
I want to fetch all the sites that I'm following but want to eliminate those that don't have newsfeed/site feed enabled.

There is a REST endpoint to fetch all the sites that I'm following:

/_api/social.following/my/followed(types=4)

This rest endpoint gives me all the sites that I am following but doesn't tell me anything about if that site has newsfeed or not.

So I have to make another REST call to this one:

/_api/web/features/getById(guid'15a572c6-e545-4d32-897a-bab6f5846e18')

The problem is that I am not in SharePoint context. I am doing all this in an AngularJS app and when I try to access this endpoint, I get an exception:

XMLHttpRequest cannot load /_api/web/features/getById(guid'15a572c6-e545-4d32-897a-bab6f5846e18'). No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '' is therefore not allowed access.

Is there any better way to deal with this? Do I need to set a header in my REST call to not get this cross domain exception?

Thanks

2
  • Try: executor = new SP.RequestExecutor(webUrl); executor.executeAsync and then use url as"/_api/SP.AppContextSite(@target)/web/features...
    – Aveenav
    Jun 18, 2014 at 18:02
  • Hey Aveenav, As I mentioned I am doing this in angularjs app so i don't have SharePoint context. The solution you proposed works well if i am building sharepoint hosted apps for example. Jun 19, 2014 at 7:55

1 Answer 1

0

You check the following links for angualarJS with sharepoint.

http://saikiran78.wordpress.com/2014/01/17/getting-list-data-in-sharepoint-2013-using-rest-api-and-angular-js/

https://www.twilio.com/blog/2013/12/votr-part-5-angularjs-crud-restful-apis.html

Hope this helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.