0

我有要求获取共享点文件的文件流,为我有共享点文件的URL。如何从动态crm插件中的sharepoint文件url获取文件流?

https://mysite.sharepoint.com/sites/documents/contact/test/Beat01_07262017.pdf

我试图从CRM Online中的插件内连接到SharePoint Online中(使用CSOM)。为此,我将SharePoint Client和Client.Runtime DLL与ilmerge.exe合并到我的插件DLL中。但是,只要下面的代码:

ClientContext clientContext = new ClientContext(server); 
clientContext.Credentials = new SharePointOnlineCredentials(UserId, Password); // This line throws an below exception: 

请求类型的许可 “System.Security.Permissions.RegistryPermission,mscorlib程序, 版本= 4.0.0.0,文化=中性公钥= b77a5c561934e089' 失败。

有什么办法可以让它工作吗?

我与SharePoint Integration from CRM Online Workflow/Plugin检查,但没有能够得到它的工作 并得到如下错误

例外:异常已通过调用的目标引发异常。

堆栈跟踪在System.RuntimeMethodHandle.InvokeMethod(对象目标,对象[] 参数,签名Sig,布尔构造函数) 在System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(对象OBJ, 对象[]参数,对象[]参数) 在System.Delegate.DynamicInvokeImpl(对象[]参数) 在Microsoft.Xrm.Sdk.Linq.QueryProvider.DynamicInvoke(委托项目, 对象[]参数) 在Microsoft.Xrm。 Sdk.Linq.QueryProvider.TranslateExpressionToConditionValue(Expression EXP,ParameterExpression []参数) 在Microsoft.Xrm.Sdk.Linq.QueryProvider.TranslateWhereCondition(BinaryExpression 是,FilterExpressionWrapper parentFilter,Func键2用getFilter,Func键2 getLinkLookup,布尔否定) 在Microsoft.Xrm.Sdk .Linq.QueryProvider.TranslateWhere(字符串 参数名称,BinaryExpression是,FilterExpressionWrapper parentFilter,Func键2用getFilter,列表1个linkLookups,布尔 否定) 在Microsoft.Xrm.Sdk.Linq.QueryProvider.TranslateWhereBoolean(字符串 参数名称,表达exp,FilterExpressionWrapper parentFilter, Func 2 getFilter,List 1 linkLookup S,BinaryExpression父,布尔 否定) 在Microsoft.Xrm.Sdk.Linq.QueryProvider.TranslateWhere(QueryExpression QE,字符串参数名称,表达式exp,列表1个linkLookups) 在Microsoft.Xrm.Sdk.Linq.QueryProvider 。GetQueryExpression(表达式 表达,布尔& throwIfSequenceIsEmpty,布尔& throwIfSequenceNotSingle,投影&投影, NavigationSource &源,列表1个& linkLookups) 在Microsoft.Xrm.Sdk.Linq.QueryProvider.Execute [TElement](表达式 表达) 在Microsoft.Xrm.Sdk.Linq.QueryProvider.System.Linq.IQueryProvider.Execute [TResult](式 表达) 在System.Linq.Queryable.FirstOrDefault [TSource](1个IQueryable的源 ) 在CRMPluginProject1._365Immo.Laurus.SharePoint.DocumentLocationHelper.GetDocumentLocationPath(SharePointDocumentLocation parentLocation) 在CRMPluginProject1._365Immo.Laurus.SharePoint.DocumentLocationHelper.CreateDocumentLocation(实体 网站,弦乐documentLibraryName,的EntityReference regardingRecord) 在CRMPluginProject1._365Immo .Laurus.Plugins.GetSharePointFile.Execute(IServiceProvider的 的ServiceProvider)

内部异常: 的需求未能由于创作的过程中捕捉的代码访问安全性信息,匿名运行 动态方法。为了使此操作成功,请确保 需求在创建方法时成功。 有关更多 的信息,请参阅http://go.microsoft.com/fwlink/?LinkId=288746

堆栈跟踪:在lambda_method(关闭)

回答

1

SharePoint客户端库显然需要访问Windows注册表。这在沙盒CRM插件中是不允许的。

在沙盒插件中,只允许使用http或https协议访问Web上的资源。 (IP地址也是不允许的。)

+0

我有要求从共享点访问文件。我怎么能实现它?对于从CRM上传文件到Sharepoint,我使用了第三方插件,它返回文件的URL。如“https://mysite.sharepoint.com/sites/documents/contact/test/Beat01_07262017.pdf” –

相关问题