I will eventually link this blogpost to a series of blogposts on Sandbox solutions, but for now, Here is a tiny little powershell script that will allow you to register a full-trust proxy that you can then use with sandbox solutions in SharePoint 2010. Put this in a file called “RegisterProxy.ps1”.
1: Param($assemblyName, $typeName)
2: $userCodeService = [Microsoft.SharePoint.Administration.SPUserCodeService]::Local
3: $proxyOperationType = new-object -typename Microsoft.SharePoint.UserCode.SPProxyOperationType -argumentlist $assemblyName, $typeName
4: $userCodeService.ProxyOperationTypes.Add($proxyOperationType)
5: $userCodeService.Update()
The usage is hella simple -
From powershell, run the following command -
1: .\RegisterProxy.ps1 -assemblyName "SandBoxWebPartWithProxy, Version=1.0.0.0, Culture=neutral, PublicKeyToken=64b818b3ff69ccfa" -typeName "SandBoxWebPartWithProxy.ProxyCode.FileCreateOperation"
You can also easily verify if the proxy got registered or not! by running the below -
1: [Microsoft.SharePoint.Administration.SPUserCodeService]::Local.ProxyOperationTypes