Tell me more ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

How could you programatically determine if code is running in an on-premise Sandbox model or SharePoint Online sandbox?

share|improve this question
Interesting Question. I am just trying to think of a scenario where you would require such a distinction to be made. SharePoint Online is just SharePoint Server hosted on the cloud so your solution should behave the same on both. Are you facing any differences? – Vardhaman Deshpande Oct 25 '12 at 15:33
2  
There are a few differences in what you can do - e.g. you can't use pretty much anything in Assembly namespace in Online - they have some extra validation/restriction over and above sandbox on premise. For my particular use case its about restrictions on different version for licensing. – Ryan Oct 25 '12 at 16:50

2 Answers

A good comparison of them is here:

http://www.helpmeonsharepoint.com/2012/06/differences-between-sharepoint.html

As for checking the environment I would look for the _layouts/QuickShare.aspx

Since it is a SharePoint 365 only feature.

[update] Something like:

XslCompiledTransform.Load("https://<site>/_layouts/QuickShare.aspx", settings, resolver); 

Should work right maybe not with outbound requests blocked? Okay it's messy but I can't think of another way that you can load a remote file on 365 at the moment.

But you could do something to throw it at the client side to update a local list?

[note] When the new version comes out, you will be able to do things like this much easier!

share|improve this answer
How would you look for _layouts/QuickShare.aspx in the sandbox model on SharePoint Online? – Ryan Nov 2 '12 at 17:09
Updated for an idea, I didn't have time to test it. Failing that JavaScript and write the result to a list, I guess there are a few ways I know outbound requests are a pain though. – Hugh Wood Nov 2 '12 at 17:24

Could you just check if the current request URL contains "SharePoint.com"?

share|improve this answer
You can have custom domains - onlinehelp.microsoft.com/en-gb/office365-enterprises/… – Ryan Jun 12 at 11:21
That is a good point. I guess my method would work for Private Site Collections, but not Public Web Sites. – Mark Stokes Jun 13 at 11:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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