Recently I’ve been working on an Office 365 based SharePoint solution. It’s a system to allow a company to create sites to collaborate with their customers, and I learnt some interesting things on the way. In part 1 I’ll deal with the technical side of things, and in part 2 I’ll look at more ‘project’ level observations. Continue reading “Office 365 – Technical observations from a first project”
SPWeb.Properties serialization in the Sandbox
I was trying to store and retrieve some properties on an SPWeb object inside the sandbox. SPWeb has SetProperty() and GetProperty() methods, which accept and retrieve objects. I thought I’d use an enumeration to represent my value, and I’d cast my enumeration value when I retrieve it. However, when I tried this I got an exception of the form:
System.Runtime.Serialization.SerializationException was unhandled Message=Unable to find assembly ‘<my assembly strong name>’
Interesting. I tried similar code within a Console application using the full SharePoint API… Continue reading “SPWeb.Properties serialization in the Sandbox”
TFS, Versioning and Office 365 SharePoint
So, I am a big fan of putting build numbers or SVN revisions into the AssemblyFileVersion of my assemblies. I can then use a little bit of the System.Reflection API to get the AssemblyFileVersion, and display it to the user, write it to logs, etc..
However, I ran into a hitch when working with Office 365. Although reflection worked fine on my local machine’s sandbox, I got an error when I tried to run the same code on Office 365’s SharePoint system. It was pretty obviously and emphatically using System.Reflection that was the problem.
This was a shame, as my build process is (as usual) putting the AssemblyFileVersion in. Sadly, I don’t see any easy way to get the AssemblyFileVersion value from within Office 365 code. So, alternatives? Continue reading “TFS, Versioning and Office 365 SharePoint”
MissingMethodException when calling SPWeb.Recycle() in Sandbox solution
Service Pack 1 for SharePoint 2010 introduced a new method for the SPWeb object – Recycle(). This allows you to send a site to the recycle bin, rather than deleting it outright. I’ve used it before in Farm solutions without any issue.
However, I’m now working on a sandbox solution, and when I tried using it, I got the error:
MissingMethodException Method not found: ‘Void Microsoft.SharePoint.SPWeb_SubsetProxy.Recycle()’.
Hmm. That’s strange; my call to recycle seems fine, and the documentation says it’s available in the Sandbox, but internally there seems to be a missing method.
Out of curiousity, I tried using Delete() rather than Recycle(), and this worked correctly. So what gives? Continue reading “MissingMethodException when calling SPWeb.Recycle() in Sandbox solution”
No CssRegistration control in Sandbox
Hmm – and interesting problem; in the Sandbox you don’t have any access to the CssRegistration class. It’s in the Microsoft.SharePoint.WebControls namespace, and you don’t have access to that.
<Link> tag into the
<Head> of the page.
Clever, but yuck! Continue reading “No CssRegistration control in Sandbox”
Sandbox Development – Reference the User Code DLL
Remarkably, I’ve only just started doing my first Sandboxed development in SharePoint 2010. (Most of our customers own their own servers, and want functionality you can’t easily build in the Sandbox alone).
Anyway, I knew that the API you could use in the sandbox was smaller than the full API, and I wanted my solution to warn me (e.g. fail to compile) if I tried to use something that wasn’t available in the sandbox. I found two approaches… Continue reading “Sandbox Development – Reference the User Code DLL”