web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

plug-in Occurred an Error "System.Security.Permissions.EnvironmentPermission" when isolation mode is "sendbox"

(0) ShareShare
ReportReport
Posted on by

Referencing a third party DLL to load "XLSX" from Notes Attachment , And using ILMerge merge DLL.

It fine when isolation is none.

but specify isoation mode to SendBox , I got Error message :

 Request for the permission of type 'System.Security.Permissions.EnvironmentPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

below is the code where error happend.

using System.Data;
using Excel;

DataTable getDataSource(string fileBody)
{
try
{
byte[] result = Convert.FromBase64String(fileBody);
IExcelDataReader excelReader = null;
excelReader = ExcelReaderFactory.CreateOpenXmlReader(new MemoryStream(result));

if (excelReader != null)
{
excelReader.IsFirstRowAsColumnNames = true;
DataSet ds = excelReader.AsDataSet();
excelReader.Close();

if (ds.Tables.Count > 0)
return ds.Tables[0].Copy();
}

return null;
}
catch (Exception ex)
{
logMssage(ex.Message, true);
return null;
}
}


*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Community Member Profile Picture
    on at

    For Sandbox mode there is a some restriction, in your case you have to select "None" mode.

    Checkout the below link.

    msdn.microsoft.com/.../gg334752.aspx

  • Verified answer
    Community Member Profile Picture
    on at

    it's resolved : replace IExcelDataReader  by SpreadsheetDocument

    but LL becoming huge...

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans