Skip to main content

Posts

Showing posts with the label Sandbox

SharePoint 2010 : Sandbox Solution Part 4 Full Trust Proxy

Full Trust Proxy:  Sandboxed solution to execute an action that is ordinarily not available to sandboxed solutions . One of these techniques is to create a special kind of operation that runs in a full trust process, but that can be called from a sandboxed solution. The operation is deployed as a farm solution by a farm administrator who trusts it and is prepared to let sandboxed solutions call it. These operations are called   full-trust proxy operations. ( Microsoft Definition ). Other words: Full trust proxy is a farm solution that runs Outside the Sandbox Solution.  Sandbox Solution uses that assembly and call Execute method to perform the operation which was out the scope of sandbox solution. The class inherits from SPProxyOperation .  Full trust Proxy Input parameters used as serialize class (used “Serializable” attribute) that inherits from SPProxyOperationArgs  Register proxy with User Code Service during Feature activation.  ...

SharePoint 2010 : Sandbox Solution Part 3

Developing Solution in Sandbox Client Side Microsoft.SharePoint.Client DLL JavaScript Silver Light Web Part Full trust proxies InfoPath Forms Microsoft Tools For Sandbox Solutions :  Visual studio 2010 SharePoint Power Tools that contains visual web part.  Sandboxed-compatible Visual Web Part  This item template enables you to use a visual designer to create SharePoint web parts that can be deployed in a sandboxed solution for SharePoint 2010. Sandboxed Compilation  This extension displays build errors when you use types or members in a SharePoint 2010 sandboxed project which are not allowed in the SharePoint sandbox environment.   Deploying Pages and Web Part Steps are: Create  Sandboxed-compatible Visual Web Part deploy as sandbox solution. Create web part page placed sandbox web part on it. Save site as template Template import to new  Import SharePoint Solution Package project Sandboxed-com...

SharePoint 2010 : Sandbox Solution Part 2

Sandbox supported DLLS You can add the Microsoft.SharePoint.DLL C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\UserCode\assemblies\ Microsoft.SharePoint.dll Sandbox Prohibited Classes and functions All other SharePont Object Model Assembly except Microsoft.SharePoint.dll. Example you can not add the other SharePoint exmple. Microsoft.Office.Policy.dll, Microsoft.Office.Server.UserProfiles.dll etc.  SPSite Constructor  SharePoint.WebControl (Can not Access SharePoint Picker Control, CssLink etc)  SPSecurity (not run with elevated  privileges). SendEmail Can not assess any Database Can not write to disk can not load the assembly outside the server except Without AllowPartiallyTrustedCallersAttribute  (Full trust proxy run on the farm.). Most of the user use the sand box don’t have a access to their server. No custom Web services No Talk to any other servers from the server.  No Pragmatic workflow deplo...

SharePoint 2010 : Sandbox Solution Part 1

Sandbox Solution is similar to SharePoint Web Solution Package the difference this solution only deploys at the site collection solution gallery. It is activate by site collection owner. Sandbox Solution you get the restricted subset permission of SharePoint Object Model.  SPUCHostService.exe :  Code runs under special monitored process called  SPUCHostService.exe SPUserCodeWebPart : Web Part that loads the Sandbox Web part Called SPUserCodeWebPart Wrapper. SPUCWorkerProcess.exe : Sandbox run under the worker Process called SPUCWorkerProcess.exe.  This is process you need to Attach for debugging. SPUCWorkerProcessProxy.exe : Communication to the farm under full trust using SPUCWorkerProcessProxy.exe We need Sandbox solution because: You don’t have a SharePoint Farm Permission but you still want to deploy the custom code in SharePoint this is only way to deploy the custom code in SharePoint. Hosted environment you want to deploy the custom code. T...

SharePoint 2010 Sandbox serialize & Deserialize the data to JSON

My requirement to serialize strongly typed data (settings) that I will used for later used. But sandbox will not allow us to serialize the data and store into the file. we can't store the file into the file system but we can create the hidden document library(lets say "mydoc" as used in the below example)  in SharePoint we can store over there. Found the work around 1. JavaScriptSerializer Class its provide the way to serialized the data into JSON. 2. I used this class and serialized the data into JSON. 3. Then I Created the Hidden Document library and store serialized data into in this document library. 4. Whenever I required this setting read the information form that file as string and Deserialize that string into strongly typed data. Following an example     using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.T...