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

  • Try: executor = new SP.RequestExecutor(webUrl); executor.executeAsync and then use url as"/_api/SP.AppContextSite(@target)/web/features... – Aveenav Jun 18 '14 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. – Sanjay Bhagia Jun 19 '14 at 7:55
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, privacy policy and cookie policy

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