Full Trust Proxies in SharePoint 2010 Sandboxed Solution – Faqs

  1. What is full trust proxy in the context of SharePoint 2010 Sandboxed Solution?

    A full trust proxy is a mechanism that allows Sandboxed Solution to make a call to trusted assembly outside the Sandbox environment. The trusted assembly can be designed to make external calls (to database or web services), which Sandbox solutions cannot reach. This needed, because not all the SharePoint 2010 solutions might want to live as Sandboxed (with restrictions). In most of the cases, the assemblies inside SharePoint solutions might want to make external calls (to a database or to a web service).

     

  2. How to create a full trust proxy operation in Sandboxed Solution?

    Here are the steps required to create full trust proxy operation using Visual Studio:-    

    1. Create a farm solution , create a c# class that is derived from SPProxyOperation and override Execute method
    2. Create another c# class (in the same solution), that is derived from SPProxyOperationArgs. Pass an instance of this class to the Execute method of SPProxyOperation class.
    3. Create a Feature Receiver to register operation with SharePoint Foundation User Code Service
    4. In the Sandboxed Solution project, create a class that calls the proxy operation
    5. Deploy the Sandboxed solution

       

  3. In which process does the full trust proxy runs?

    The full trust proxy does not run in w3wp.exe, rather it runs in SPUCWorkerProcessProxy.exe.

     

  4. How to programmatically activate the full trust proxy with user code service?

    The following is the code snippet for activating full trust proxy.

     

         SPProxyOperationType proxyOperationType = new SPProxyOperationType(type.Assembly.FullName, type.FullName);

    SPUserCodeService userCodeService = SPUserCodeService.Local;

    userCodeService.ProxyOperationTypes.Add(proxyOperationType);

    userCodeService.Update();

     

  5. How to programmatically de-activate the full trust proxy with user code service?

    The following is the code snippet for de-activating full trust proxy.

 

     SPProxyOperationType proxyOperationType = new SPProxyOperationType(type.Assembly.FullName, type.FullName);


     SPUserCodeService userCodeService = SPUserCodeService.Local;


     userCodeService.ProxyOperationTypes.Remove(proxyOperationType);


     userCodeService.Update();


 Subscribe to my blog

One thought on “Full Trust Proxies in SharePoint 2010 Sandboxed Solution – Faqs

  1. Pingback: Full Trust Proxies in SharePoint 2010 Sandboxed Solution - Faqs - My experiments with SharePoint, Azure and .NET using Visual Studio

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.