2

I want to know whether managed client object model works in cross domain cases.

For example I have a console application in Domain A, can I use managed client object model in the console application which access data from a sharepoint server in another domain B.

Do I have to add "ClientAccessPolicy.xml" for managed client object model.

any help is highly appreciated and please let me know about the ECMA and silverlight client object model realted to cross domain.

thanks in advance.

2 Answers 2

2

If you are using a console app, there is no problem with cross-domain. The console app is actually not running in a "domain". Therefore you don't need the ClientAccessPolicy.xml and can access any SharePoint site.

For Silverlight running in domain A, you need the ClientAccessPolicy.xml on domain B if you want to access it. I'm not sure about JavaScript.

2
  • thanks for the quick response Marco. What if I am using the .Net managed client object model in a event receiver or webpart in domain A to access data from a different sharepoint server in domain B. Does the managed client object model need any extra settings or not? I just wanna make sure. FYI: In javascript client object model we can not do cross domain, infact we can not do cross site I guess.
    – explorer37
    Commented May 10, 2012 at 19:26
  • I've never used the client OM within an event receiver or a web part, because you can use the server OM. Well, not in your case, so I think you have to try this out ;-)
    – marco
    Commented May 11, 2012 at 5:57
2

Marco's answer is correct. I developed a Silverlight web part displaying information retrieved by a HTTP service from other domain. You'd have to deploy either clientaccesspolicy.xml (new from MS, if you use just Silverlight) or crossdomain.xml (originally from Adobe, if you use both Flash and Silverlight) to the root of the web application you access in the other domain.

If you wanted to use the JavaScript OM directly on your page it wouldn't work. The JavaScript OM works only on SharePoint pages and only from within the same site collection. It is meant to help developing sandboxed solutions and not intended for cross-site calls.

Generally for JavaScript you'd have to enable cross-domain JavaScript on the server in the other domain - at least for your pages - to be able to perform the call. I found that in the meanwhile browsers are able to do it when using the usual XMLHttpRequest; I didn't need XDomainRequest in IE. To access SharePoint, you could expose the functionality you need as a REST WS (developed and deployed as a SharePoint solution) and use XMLHttpRequest on your page to call it. Cross-domain access to SharePoint from pure JavaScript YES but pure client solution NO ...

--- Ferda

1
  • One addition: SharePoint has a built-in REST service. You can access it by [site]/_vti_bin/listdata.svc
    – marco
    Commented May 13, 2012 at 16:28

Your Answer

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

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