Sandbox mode implies you'll have to do it all at a site level. Personally I'd be going with a CDN link, and additionally I'd be checking to see if it's already been loaded elsewhere in the page - useful in the case of a jquery-dependent webpart which may be included two or three times in a page:
Of course, if the solution you'...
I ultimately ended up just using a foreach loop to iterate through the SPWeb.Lists collection and then check each list's BaseTemplate value to get all the picture and asset libraries. Code provided below:
private void PopulateImageLibraryDropDownList()
You are not allowed to call ANYTHING outside of the Sandbox. A call to listdata.svc is a call outside the sandbox, requiring System.Net.WebPermissions. This is prohibited by the CAS policies on the Sandbox.
You basically have three ways to get around this:
Use a farm solution
Build a Sandbox Full-Trust proxy solution
By default, code access security denies WebPermission to code running in a sandboxed solution (see Restrictions on Sandboxed Solutions in SharePoint 2010)
However, you can create a full-trust proxy operation that will enable you to call the services. (see Sandboxed Solutions in Partnership with Full-Trust Proxies in SharePoint 2010)
I read that sandbox solution is not preferred in SharePoint 2013 and we should use the app model. So is creating artifacts an available approach to do inside SharePoint apps?
Yes there are multiple available approaches. The one I use the most is (for provider hosted add-ins) to use a remote event receiver on AppInstalledevent. In the event receiver you can ...
The System.Net.Mail namespace works with on-premise Sandbox solutions but does not work with Office 365, so there is no way to send email from code. The "Send Email" activitiy in SharePoint Designer workflows in Office 365 does work, so yes, you can use workflow to send email.
No you cannot set cookies in the sandbox, the data are not transferred back between the sandbox and the IIS. The Sandbox lives in it's own process and the HttpContext.Current is different from the HttpContext.Current in ASP.NET (that lives in IIS and the w3wp.exe process)
For more limitations see: http://www.wictorwilen.se/Post/Understanding-the-SharePoint-...
It’s better to use the Delete() method of SPWeb.Lists instead of using the Delete() method on the SPList because the latter doesn't delete lists properly sometimes. Try something like:
SPWeb mySite= SPContext.Current.Web;
SPList myCustomList = mySite.Lists["MyCustomList"];
The Page object you're getting in the Sandboxed webpart isn't the real page, so this in one of the things that won't work.
Option 1: Render in RenderContents
You can manually render your script include in RenderContents:
protected override void RenderContents(HtmlTextWriter writer)
string jQuerySrc = Page.ClientScript.GetWebResourceUrl(this.GetType(), "...
You best chance is to try at least four things while debugging:
Use logging library "SharePoint Sandbox Logging" to log errors on
feature activation, as you probably know logging capabilities on
Sandbox are limited.
Have Correlation Id with your error? contact Microsoft support
Review SharePoint logs for on-premises Sandbox to check for any
errors, warnings ...
This is how to check for sandbox:
// I'm in a SandPit
This is how to check for SPO:
// I'm in the clouds
As you have discovered SPLimitedWebPartManager is not availabe on Sandboxed solutions.
Snippet from Waldek Mastykarz blog:
Inconvenient provisioning Web Parts instances from Sandboxed Solutions
One of the challenges when working with Sandboxed Solutions is how to
provision Web Parts instances to pages. If you have done this before
in a Farm ...
I no in your post you said "without an external application" but does that include js libraries?
Below is a simple solution that will copy a document from one SP library to any other SP library.
I have not verified its cross-site scripting capabilities but it theoretically should work across farms, domains, and different SP versions. (It 100% works across ...
Regardless of what code, or lack thereof, is contained in the solutuion SharePoint will still execute the user/sandobexed soultion inside the sandbox, i.e. it is run but the User Code Service.
I'd take a look at the setup of the User Code Serivce and verify that it is correct, this blog posting may help: http://bramnuyts.wordpress.com/2011/05/17/sandboxed-...
Yes, SharePoint lists are your only option in this case.
Each request is marshalled from ASP.NET/SharePoint to a specific Sandbox process. These processes and AppDomains are not guaranteed to be the same or even on the same machine, so any kind of in-memory cache is out of question.
The most preferred location to add JQuery is the "Site Asserts" library which exists in SharePoint Online - Office 365 site. Quick Steps to create a solution for this
Create a Empty Solution in Visual Studio 2010 and deploy it as sandbox.
Create a Folder called JQuery.
In this Folder add an new Module. You would notice you get a new Elements.xml and a txt ...
You will need to use the appropriate Resource. In your case, it's in core.resx, resource key "webpartgalleryList". Note that the Web Part Gallery is always at the root of the site collection, so for maximum portability you should access it using web.Site.RootWeb, not web. Also, SPListCollection[string listName] will already throw an exception if the list is ...
Application pages are not allowed in Sandboxed solutions.
So all pages have to be site pages, deployed through modules. These modules can then be added to features which can be activated on the difference sites depending on which pages is needed on each site.
Also it seems that to deploy a solution, I can simply upload a wsp to
the solution gallery within a site collection and activate the
Yes this is right.
So if I develop say a basic webpart on a dev laptop with installation
of SP, VS, etc, and I reference my local sharepoint implementation in
the project do I need to somehow change this in ...
You have to be a bit tricky to include codebehind for your custom pages in sandbox solutions. Here's a little tutorial on how to do it:
For example, here's my custom ASPX page:
<%@ Page language="C#"
The code compiles and runs fine for me as long as there is a reference to Microsoft.SharePoint (2010). Are you building a console application? In that case make sure you are using the .NET 3.5 framework (not compact or anything else) and set the platform target to Any CPU in the build section of the project properties.
BTW. note that you are leaking a site ...
It's related to the sandbox, because you cannot use SPFolder.ContentTypeOrder and SPFolder.UniqueContentTypeOrder in sandbox :\
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No
If it's just to order, the code posted as an answer by James in this question might work.
Well it's taken a few days but I've finally managed to work this one out however it did involve me having to dissect the whole project and reintroduce each piece one at a time.
A few issues were causing it:-
1) I had set one of the projects "Include Assembly in Package" property to false.
2) A static method was making a call to an SPList which turned an ...
You cannot use the SharePoint root folder, nor any of its sub folders.
However, you can deploy an aspx file to the content database using a module. Look at the solution here: http://spkbase.codeplex.com
That solution also uses the SPUserCodeWebPart to run server-side code on those aspx pages.
This sort of task is more suited to an event receiver.
The itemAdded approach will certainly give you access to the ID. An event receiver does not have the typical delay you see with Workflows, it fires right away.
One issue you can experience with ItemAdded events is that they run asynchronously. What this means is that the control is returned to the UI ...
Using a pure Sandboxed solution this is not possible. A sandboxed solution has absolutely no access outside the current site collection, that's the whole point of sandboxed solutions.
If you're solution is developed for on-premises SharePoint where it's "just" politics which require the solution to be Sandboxed. Then there is the possibility of ...
Are there only 2 kinds of SharePoint Solutions?
yes, but since SP 2013 we could count the APPs as a separate solution type as well
Does the SharePoint Foundation Sandboxed Code Service" (SPUserCodeV4)
have to be active ...
On what server(s) should...Code Service" (SPUserCodeV4) be active?
I would suggest on the front end
"Save Site as ...