Friday, July 19, 2013

Providing permission to access MS-Office application through CRM Plugin

More often business need arises to update MS office word or excel with the data from MS CRM. But accessing MS Office applications using plugins result in security issues as these applications restrict CRM plugin directly accessing them. This need a special permission to be setup at the MS Office components which allows them to access via CRM plugin. Here I have provided the steps to achieve the same.

You must give the following permissions to office application to enable the access:

1.        Activation & Access Permission.
2.        Set the Identity.

Steps to provide the Activation & Access Permission:

Go to Control Panel->Admiration Tools->Component Services->Computers->My Computer->DCOM Config.

Click Microsoft Excel Application -> Properties.

Select customize option under the Security tab (Security->Launch and Activate Permission->customize & Security->Launch and Access Permission->customize).

Click edit and provide the administrator permission:

Set the Identity.

Select user option under the identity tab and provide the administrator username & password as shown below:

After providing these permissions, you could try access the Excel application programmatically with the following code from plugin:

ExcelSheet.Excel.Application excelApp = new ExcelSheet.Excel.Application();
string myPath = @"E:\File Maintanence\Sample.xlsx";
int rowIndex = 1; int colIndex = 1;
excelApp.Cells[rowIndex, colIndex] = "Sample two";
excelApp.Visible = true;

Hope this blog helps!!!!!

No comments:

Post a Comment