带CRM插件和Sharepoint Online的ILMerge [英] ILMerge with CRM plugin and Sharepoint Online

查看:90
本文介绍了带CRM插件和Sharepoint Online的ILMerge的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过nuget向我们ILMerge合并两个SharePoint程序集到我的插件dll中。程序集为;

I am trying to us ILMerge via nuget to merge two SharePoint assemblies in to my plugin dll. The assemblies are;

Microsoft.SharePoint.Client  (v16.1)
Microsoft.SharePoint.Client.Runtime (v16.1)

它们似乎已成功合并到我的单个插件dll中,我可以看到所需的内容

They seem to successfully merge in to my single plugin dll and i can see the required classes etc if I inspect the dll with JustDecompile.

在调试插件时,它会引发安全异常;

When debugging the plugin, it throws a security exception;

Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=4.0.0.0

该代码成功地完成了Microsoft.SharePoint.Client dll中的'ClientContext()'的创建过程,但在到达'new SharePointCredentials()'行时失败

The code successfully steps over the creation of 'ClientContext()' which is located in the Microsoft.SharePoint.Client dll, but then fails when it reaches the 'new SharePointCredentials()' line which is held in the Microsoft.SharePoint.Client.Runtime dll.

    using (var srcContext = new ClientContext(url))
    {
        srcContext.Credentials = new SharePointOnlineCredentials(username, securePassword);

我对为什么会发生这种情况感到困惑。它是Dynamics 365在线和SharePoint在线。提供给构造函数的凭据正确。任何指针将不胜感激。我真的不想创建Web服务,而不是ILMerging SharePoint dll。

I am stuck as to why this might be happening. It is Dynamics 365 online and SharePoint online. The credentials supplied to the constructor are correct. Any pointers would be greatly appreciated. I really don't want to have to create a web service instead of ILMerging the SharePoint dlls.

推荐答案

到要求Dynamics 365 Online不允许的权限的方法。这通常是在Dynamics 365 Online中运行的Plugin / Workfrom中的 System.Security.Permissions.SecurityPermission 错误的原因。

This is almost undoubtedly related to the to the method being called requiring permissions that Dynamics 365 Online does not allow. That is usually the cause of a System.Security.Permissions.SecurityPermission error in a Plugin/Workfrom running in Dynamics 365 Online.

已经很长时间了,但是如果内存能够正确地为我提供服务,则SharePoint客户端库将无法在Dynamics 365沙箱插件中运行(并且所有在线插件都在沙箱中。)

It's been a longtime, but if memory serves me correctly the SharePoint client libraries do not work in Dynamics 365 sandbox plugins (and all online plugins are in the sandbox.)

除非您找到一种无需使用库即可进行调用的方法,请使用 SharePoint REST API ,您必须创建一个Web服务,或者(我认为,如果可能的解决方案,则更可取)使用Azure Service Bus处理执行。

Unless you can find a way to make the calls without the libraries, using the SharePoint REST API, you'll have to either create a web service or (in my opinion the preferable if possible solution is to) use Azure Service Bus to handle the execution.

这篇关于带CRM插件和Sharepoint Online的ILMerge的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆