I’m trying to connect to SharePoint 2013 Online (using CSOM) from within a sandboxed plugin in CRM 2013 Online . For that to work, I merged the SharePoint Client and Client.Runtime DLL’s with ilmerge.exe into my plugin DLL. But as soon as the following code:
_context = new ClientContext(spSiteUrl)
{
Credentials = new SharePointOnlineCredentials(username, securePassword)
};
tries to create the SharepointOnlineCredentials
it throws an exception because of the Sandbox limitations:
System.Security.SecurityException: Request for the permission of type ‘System.Security.Permissions.RegistryPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089′ failed.
Did anyone solve this problem, or are there other options for CSOM authenticating with SharePoint 2013 Online?