1

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?

Maarten Docter
  • 1,029
  • 1
  • 13
  • 31
  • Did you ever solve the issue of connecting to Sharepoint from CRM? – sreimer Sep 30 '14 at 21:21
  • @sreimer Unfortunately not. I ended up creating an external proxy web service, which handles all SharePoint related business logic. From the plugin I call this web service to do all the work. Keep in mind that the SharePoint performance with larger databases (i.e. > 35 GB) is pretty poor, so you can run into the two minute plugin execution time limit. In that case your plugin will be killed. Another option would be the use the good-old SharePoint web services directly from the plugin instead of using CSOM. – Maarten Docter Oct 01 '14 at 07:19
  • Office 365 appears to still need authentication tokens for the webservice which is where I'm stuck using REST – sreimer Oct 01 '14 at 13:33
  • @sreimer Maybe this article by Wictor Wilén can help you with that: [http://www.wictorwilen.se/post/how-to-do-active-authentication-to-office-365-and-sharepoint-online.aspx](http://www.wictorwilen.se/post/how-to-do-active-authentication-to-office-365-and-sharepoint-online.aspx) – Maarten Docter Oct 02 '14 at 09:11

0 Answers0