I'm currently working on a solution which has to work in the Office365 SharePoint Online environment. Being Sandboxed, I'm running into problems with my code which is working fine on my local environment.

The setup is pretty simple. I have a list where users can create items. After creating an item, an event receiver picks it up and processes the item. The event receiver creates a site based on the users input in the list. This operation seems to take too long sometimes. After the site creation, the URL of the newly created site is saved back to the list item. This sometimes happens, but mostly doesn't. I'm pretty sure it's the 30sec timeout which is causing this.

Because the operation is kind of async to begin with, I don't really care about the sequence of event. Therefore I thought I might be able to use the client model or webservices instead. Fire off an async call to create the web and thereby bypassing the 30 sec timeout.

Has someone ever been able to do this? I know the client model isn't restricted to timeouts, but I don't think the sandbox allows you to use the client model (which is kind of strange to begin with I guess).

  • Can you show your code? I don't think creating one site will consume 30 secs. How big is the site? Jun 19 '12 at 9:03
  • The site is based on a custom web template which activates some features. Nothing special, just some lists and receivers and stuff like that. But I counted the time it takes before the error appears, and that's roughly 30 seconds. The times it succeedes it takes a little less time, but still 25+ secs.
    – Jasper
    Jun 19 '12 at 10:34
  • How much time does the site take to get created if you create it from the UI? I am thinking your code might contain something that is taking too long to execute and that is why its taking so long. Jun 19 '12 at 13:01

I solved this by using a different approach. Site Builder (a third party tool) allows you to create a site from clientside code, specifying some xml template files. The client side model isn't bound to the sandbox limits, so longer running operations are no problem and your processing also doesn't add to the sandbox counters.

I deploy some templates as wsp files which the users can then use themselves to create new subsites. No problems there regarding timeouts.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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