Answered by:
Using File I/O Operations in CRM Plugin.

Question
-
Hi all,
I have requirement in which we have to copya file which resides on crm server from ex: "C:\" folder location to "D:\" Location . This Operation should be on Create and Update of Entity record . because before putting this file to target location i need to access CRM Entity Data field to rename the file. So Is the above requirement is Achievable using Plugin or custom workflow activity?
Thursday, April 25, 2013 2:29 PM
Answers
-
This is possible providing the plugin (or custom workflow activity) is not registered in the sandbox. You'll also need to ensure the relevant account (the identity of the CrmAppPool for synchronous plugins, otherwise the account used b the Crm Async Service) has permissions on the files and folders
Microsoft CRM MVP - http://mscrmuk.blogspot.com/ http://www.excitation.co.uk
- Proposed as answer by hari mallampati Thursday, April 25, 2013 5:33 PM
- Marked as answer by Siddhu336 Monday, April 29, 2013 1:03 PM
Thursday, April 25, 2013 2:41 PMModerator -
It is definitely possible to use a WCF Service, which is called from a plugin running in sandbox mode. This gives two security advantages:
- You can choose to run the WCF service in whichever identity you choose, rather than the identity of the CrmAppPool. This may allow you to more fully restrict the privileges of this account
- You could apply specific code access security on the WCF service, which would allow it access to the file system, but maybe not other resources
There is one additional security issue that you will have to consider: CRM only supports making anonymous WCF calls from the sandbox. This makes it a little harder to restrict access to the WCF service; I would recommend that you use IIS to only allow connections to the WCF service from the IP address of the CRM server
Microsoft CRM MVP - http://mscrmuk.blogspot.com/ http://www.excitation.co.uk
- Marked as answer by Siddhu336 Monday, April 29, 2013 1:04 PM
Sunday, April 28, 2013 5:57 PMModerator
All replies
-
This is possible providing the plugin (or custom workflow activity) is not registered in the sandbox. You'll also need to ensure the relevant account (the identity of the CrmAppPool for synchronous plugins, otherwise the account used b the Crm Async Service) has permissions on the files and folders
Microsoft CRM MVP - http://mscrmuk.blogspot.com/ http://www.excitation.co.uk
- Proposed as answer by hari mallampati Thursday, April 25, 2013 5:33 PM
- Marked as answer by Siddhu336 Monday, April 29, 2013 1:03 PM
Thursday, April 25, 2013 2:41 PMModerator -
Hi David,
Thanks for the reply,
I have tried the plugin with File I/O Operation registered in None Mode. All the File Operation Operation are Running Pretty fine with my plugin I am able to achieved this functionality. But, One of my colleague told me not use File Operations in plugins. Actually he recommended . I need know how safe is the code or the file used in these type plugins?
As he recommended , I went to implement a WCF service for this File Operation and i will call this service in my plugin and i will register my plugin in sandbox mode. Can you please guide whether my approach is appropriate?
Sunday, April 28, 2013 1:43 PM -
It is definitely possible to use a WCF Service, which is called from a plugin running in sandbox mode. This gives two security advantages:
- You can choose to run the WCF service in whichever identity you choose, rather than the identity of the CrmAppPool. This may allow you to more fully restrict the privileges of this account
- You could apply specific code access security on the WCF service, which would allow it access to the file system, but maybe not other resources
There is one additional security issue that you will have to consider: CRM only supports making anonymous WCF calls from the sandbox. This makes it a little harder to restrict access to the WCF service; I would recommend that you use IIS to only allow connections to the WCF service from the IP address of the CRM server
Microsoft CRM MVP - http://mscrmuk.blogspot.com/ http://www.excitation.co.uk
- Marked as answer by Siddhu336 Monday, April 29, 2013 1:04 PM
Sunday, April 28, 2013 5:57 PMModerator