I have a simple post create plugin on the Account entity that makes a subsite in SharePoint online with the same name of the Account that has been created.
I have used the SharePointOnlineCredentials
class from the Microsoft.SharePoint.Client.Runtime
assembly to login to the SharePoint instance.
The plugin works on an on-premise instance as long as the plugin is set to isolation mode = none
.
When I run the plugin in Sandbox isolation mode I get the error below (online version error).
I want to run this plugin on an online instance of SharePoint, but as, I believe, I cannot run online with an isolation mode = none, is there another way of running code using this SharePoint assembly on an online CRM instance?
Message: Create, Method: ExecutePluginLogic Exception: System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) at System.Security.CodeAccessPermission.Demand() at System.Net.AuthenticationManager.Register(IAuthenticationModule authenticationModule) at
Microsoft.SharePoint.Client.SharePointOnlineAuthenticationModule.EnsureRegistered() at Microsoft.SharePoint.Client.SharePointOnlineCredentials..ctor(String username, SecureString password) at
MWLSPXRMToolkitOnline.Plugins.AccountCreate.ExecutePluginLogic(IServiceProvider serviceProvider) at MWLSPXRMToolkitOnline.Plugins.BasePlugin.Execute(IServiceProvider serviceProvider)
The action that failed was: Demand The type of the first permission that failed was:
System.Security.Permissions.SecurityPermission The Zone of the assembly that failed was: MyComputer