While building webparts for office 365 or sharepoint online you need to develop sandboxed webparts.

To develop and deploy sandbox webparts you need to do few things for successful output.

  1. Download and install “Visual Studio SharePoint power tools”(http://visualstudiogallery.msdn.microsoft.com/8e602a8c-6714-4549-9e95-f3700344b0d9)
  2. Activate the service “SharePoint 2010 User Code Host” in services. So that error will go.
  3. For more info see at: http://sp2010solutions.blogspot.in/2012/03/sandboxed-solution-error-occurred-in.html
    1. In Visual StudioàNew ProjectàEmpty SharePoint Project

    1. Add a New Item as “Visual Webpart(Sandbox)”