Friday, 4 June 2010
Error occurred in deployment step 'Activate Features': Timeout occurred while running the SharePoint Sandboxed Code service. This service is required to run sandboxed solutions in SharePoint. Please ensure the service is configured correctly in SharePoint
Goto Services and start "Sharepoint 2010 User Code Host" Service
Wednesday, 2 June 2010
In order to call a web service in sandbox environment following steps should be followed.
Note: Assuming you already have created the web service and deployed it in IIS
1. Create a class library project and which is derived from “SPProxyOperation” (Microsoft.SharePoint.UserCode namespace).
Code Snippetclass ProxyProvider : SPProxyOperation
public override object Execute(SPProxyOperationArgs args)
if (args != null)
ProviderSoapClient client = new ProviderSoapClient();
ProviderArgs providerArgs = args as ProviderArgs;
return "Error while calling Web Service...";
2. Create another class which should be used for passing arguments to the SPProxyOperation class
3. Argument class must have “Serializable” attribute. public class ProviderArgs : SPProxyOperationArgs
public int DeptCode
public ProviderArgs(int code)
this.DeptCode = code;
public class ProviderArgs : SPProxyOperationArgs
4. Implement Execute method of SPProxyOperation class.
5. Attach below attribute with the assembly
6. Make sure assembly is strongly named.
7. Deploy the assembly in GAC using GACUTIL(Since drag and drop assembly gives access denied error).
8. Register the assembly in Sharepoint
To register a assembly in Sharepoint “Power Shell” can be used.
Write below scripts in a .ps1 file and run from power shell
$userCodeService = [Microsoft.SharePoint.Administration.SPUserCodeService]::Local
$proxyOperationType = new-object -typename Microsoft.SharePoint.UserCode.SPProxyOperationType -argumentlist $assemblyName, $typeName
9. Since this is full trust proxy class so it would run under “SPUCWorkerProcessProxy.exe” so add the web service related configuration setting in SPUCWorkerProcessProxy.exe.config file which can be found under “C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\UserCode” folder.
10. Now you are ready to call the web service method via Proxy operation class. Use below method to call the web service from your Sandbox Solution.
SPUtility.ExecuteRegisteredProxyOperation("AssemblyName, Version=126.96.36.199, Culture=neutral, PublicKeyToken=fffdd72d4537ce50", "NameSpace.ClassName", new ArgumentClass(Argument));
To query SharePoint List or Document Library in specific Folder “ FolderServerRelativeUrl ” as part of the CAML Query Code Snippet ...
Recently, I stumbled upon a situation where I had Calendar list and I had provided custom save and cancel button. In List setting I had kep...
In order to call a web service in sandbox environment following steps should be followed. Note: Assuming you already have c...