简体   繁体   English

crm dynamics online,将自定义url参数传递给插件

[英]crm dynamics online, pass custom url parameter to plugin

I want to create a plugin that reads a custom parameter from the url. 我想创建一个从url读取自定义参数的插件。 I found this piece of code 我找到了这段代码

https://blogs.msdn.microsoft.com/madenwal/2011/04/15/retrieving-querystring-paramaters-in-a-crm-plug-in/ https://blogs.msdn.microsoft.com/madenwal/2011/04/15/retrieving-querystring-paramaters-in-a-crm-plug-in/

When I tried implementing it for this call 当我尝试为此调用实现它时

  var reference = HttpContext.Current.Request.QueryString["parameter_reference"]

I got the following error: 我收到以下错误:

System.Security.SecurityException: That assembly does not allow partially trusted callers. System.Security.SecurityException:该程序集不允许部分信任的调用者。

I tried to resolve this by applying an attribute to the assembly, shown in this post: 我尝试通过将一个属性应用于程序集来解决此问题,如以下文章所示:

https://support.microsoft.com/en-us/help/839300/how-to-use-the-allowpartiallytrustedcallers-attribute-to-call-an-assembly-that-has-a-strong-name-from-a-web-page-by-using-visual-c-.net,-visual-c-2005-or-later-versions https://support.microsoft.com/en-us/help/839300/how-to-use-the-allowpartiallytrustedcallers-attribute-to-call-an-assembly-that-has-a-strong-name-from- a-web-page-by-using-visual-c-.net,-visual-C-2005或更高版本的版本

I was not sure what security permissions where needed for httpcontext ie FileIOPermission or PrincipalPermission. 我不确定httpcontext需要什么安全权限,即FileIOPermission或PrincipalPermission。 So I ended up using the SecurityPermission option. 所以我最终使用了SecurityPermission选项。

However this did not resolve the issue. 但是,这并没有解决问题。 Any ideas will be appreciated. 任何想法将不胜感激。 thanks in advance. 提前致谢。

You are probably getting that error because your plugin is running within the sandbox. 您可能会收到该错误,因为您的插件在沙箱中运行。

Plug-in isolation, trusts, and statistics 插件隔离,信任和统计信息

Microsoft Dynamics 365 (online & on-premises) support the execution of plug-ins and custom workflow activities in an isolated environment. Microsoft Dynamics 365(在线和内部部署)支持在隔离环境中执行插件和自定义工作流活动。 In this isolated environment, also known as a sandbox, a plug-in or custom activity can make use of the full power of the Microsoft Dynamics 365 SDK to access the organization web service. 在此隔离环境(也称为沙箱)中,插件或自定义活动可以利用Microsoft Dynamics 365 SDK的全部功能来访问组织Web服务。 Access to the file system, system event log, certain network protocols, registry, and more is prevented in the sandbox. 在沙箱中可以防止访问文件系统,系统事件日志,某些网络协议,注册表等。

You could try moving your plugin outside of the sandbox - look for isolation mode during plugin registration. 您可以尝试将插件移出沙箱 - 在插件注册期间查找隔离模式。

However, I would suggest taking a different approach entirely - such as reading data from record fields. 但是,我建议完全采用不同的方法 - 例如从记录字段中读取数据。 Reading from the query string is a bit unusual and the query string format has been known to change between CRM versions. 从查询字符串中读取有点不寻常,并且已知查询字符串格式在CRM版本之间发生变化。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM