Posts

Showing posts from June, 2012

SharePoint 2010 : Sandbox Solution Part 4 Full Trust Proxy

Image
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 ECMA Scripts code snippets

ECMScript  ECMScript you need to create a client context before you can retrieve data from a SharePoint site. With ECMAScript you can retrieve the client context from the SharePoint site in which the script runs. Use the Load method to specify which data to load from SharePoint. Use the asynchronous method executeQueryAsync to retrieve the information from SharePoint. This method needs a reference to a callback method when the execution succeeds and a reference to a callback method when the execution fails. To Set and Get the Properties there are ways to get the information. get_methodname set_Methodname example  get_web(),  set_title etc Update, Insert, Delete Code snippets 1. Load Site Data   <script type="text/javascript"> var clientContext = null; var web = null; ExecuteOrDelayUntilScriptLoaded(Initialize, "sp.js"); function Initialize() { clientContext = new SP.ClientContext.get_current(); web = clientConte...

SharePoint 2010 : Sandbox Solution Part 3

Image
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

Image
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

Image
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 Replaceable Parameters, Dynamic Tokens, Dynamic Folder Path

Image
Replaceable Parameters : Replace the tokens values at the run time or compile time. Information not known at design time. Replaceable parameters used in custom actions, assembly name defined at the top of the custom web part control.     Following are the list of Replaceable Parameters. $SharePoint.Project.Assembly.FullName$ $SharePoint.Feature.ID$ {ItemId}   {ItemUrl}  {SiteUrl}  {ListId}   {RecurrenceId} Working following files that use  Replaceable   Parameters by default. Xml  ASCX  ASPX  WebPart  DWP Dynamic Token (Microsoft Definition) ~masterurl This token references a master page from a content page by using the MasterPageFile attribute with the value of the CustomMasterUrl property. The token "~masterurl/custom.master" is replaced at run time by the value in the CustomMasterUrl property, which contains the server-relative full path to the master page, inc...