Friday, August 10, 2012

SharePoint: Visual Web Part(Any Web Part) with CSOM code on Sandbox Solution.

If you are initializing Web or Site object with URL and target deployment type is Sandbox, You will get below error.

Web Part Error: Unhandled exception was thrown by the sandboxed code wrapper's Execute method in the partial trust app domain: An unexpected error has occurred.

If you want to resolve this issue, change deployment type from Sandbox to Farm.