Question

I am building a SharePoint sandbox solution which consists of multiple web parts. I want to be able to somehow cache POCO objects (Plain Old CLR Objects) in such a way that the cache is persisted across full page requests and the cache works in SharePoint online as well.

I have looked at the following mechanisms:

  • Saving files on the file system or in Isolated Storage - doesn't work because the System.IO namespace seems to be blocked in sandbox solutions.
  • Using the ASP.NET Cache/Session/Application infrastructure - doesn't work, the cache is reset every time a new page request is made.
  • Using the Microsoft.Office.Server.ObjectCache.SPCache infrastructure - doesn't seem to work, the cache is reset in the same way as with ASP.NET cache.
  • using a handcoded in-memory cache: (private static Dictionary<string, object> ...) - doesn't work, the dictionary instance is lost across http page requests.

Does all of the above mean that my only option of storing any kind of data in SharePoint sandbox solutions is to use Sharepoint lists/list-items?

Was it helpful?

Solution

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.

OTHER TIPS

Instead of creating webparts, you could create Silverlight apps that do not generate a Postback.

Then again, Silverlight apps are limited due to the Client Side Object Model.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top