1

Continuing from my earlier question SharePoint Webpart development using SPA or JavaScript library for better performance

I ma exploring Durandal with JayData and also KO and SPServices. The challenge is that I cannot get the response from the rest service

http://mySharePoint/.../_vti_bin/listservices.svc

The problem is due to CORS issue. If I cannot change anything on the server, is there any way to implement this? I am trying passing on the headers for CORS. But not getting good result. I can get the results when I use Google Chrome with -disable-web-security. But that is definitely not the solution.

Any suggestions?

  • Can you add some examples of your JavaScript code as well as the structure of your SharePoint sites? Also, where are the HTML and other artifacts being used in the SPA deployed? – Robert Kaucher Jan 29 '14 at 19:30
  • Have you seen this article regrading cross-domain policy XML file and SharePoint? aspnetresources.com/blog/… – Robert Kaucher Jan 29 '14 at 19:37
  • please check edits to my original answer below – onzur Mar 5 '14 at 19:14
3

For SharePoint 2010, if your web app in has a different domain than the SharePoint site you'll get this error.

If that's the case then I don't think its possible without very hacky solutions using IFrames or JSONP.

Sorry for being the bearer of bad news but, I'm pretty sure you need server access. CORS is supposed to require server access to protect people from Cross domain attacks. Here is a link on how to do it in IIS (which hosts SharePoint)

If you have access to the SharePoint enviornment consider hosting this within SharePoint as that will make your life much easier. You can also create a directory in the IIS server and deploy your web app files there. That way you can have the same domain.

If you have to deploy on your own server you're going to have to develop your own API which calls SharePoint. That API would be best built in .Net so you can use the .Net SharePoint CSOM.

With SharePoint 2013 I would advise you take a look at SharePoint Apps. They allow you to build your application on an external system and people can install it in SharePoint

EDIT: This definitely is possible with the SharePoint 2013 app model and the cross domain library that Microsoft has provided. Take a look at this video for a full demo of what will be needed.

  • 1
    thanks for the 'bad news'. Even bad news are good news for me. I am getting to know how I might fail. – Kangkan Jan 30 '14 at 4:45
  • This blog post gives you all the options for SP 2013: blogs.msdn.com/b/officeapps/archive/2012/11/29/… – onzur Mar 5 '14 at 19:12
  • As I have said, I am working on SP2010 at this time. I know life is cooler with SP2013. – Kangkan Mar 6 '14 at 4:07

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.