从Dynamics 365访问本地文件,并且不允许本地资源 [英] Access local file from Dynamics 365 and local resource not allowed

查看:73
本文介绍了从Dynamics 365访问本地文件,并且不允许本地资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在CRM中,我们有一个项目列表,并且在网络驱动器上有与这些项目相关的文件。不想设置我们过去遇到的Sharepoint到期问题。



无论如何,在每个项目记录中,我们都想为其添加网络URI。项目的文件,因此用户可以单击CRM记录中的链接并直接转到该文件。所以像 X:\Projects\contoso 之类的。



对于完成此建议,请采纳以下建议:



http://blog.zealots.solar/ ?p = 54



基本上包括制作一个HTML页面并将其作为Web资源插入表单中,从而使其成为iframe。

 < html> 
< head>
< meta charset = utf-8>
< / head>
< body>
< a id = doclink style = border:0px currentColor; href = http://www.example.com target = _ blank>
< img style = border:0px currentColor; src = stsr_folders_icon.png>
< / a>
< script language = javascript type = text / javascript>
var linkval = window.parent.Xrm.Page.data.entity.attributes.get( stsr_documents)。getValue();
var a = document.getElementById(’doclink’);
a.href =文件: + linkval;
< / script>
< / body>
< / html>

当然会更新 window.parent.Xrm.Page.data.entity .attributes.get( stsr_documents)< img src = 。它从 stsr_documents 字段中获取URI值并将其附加到图像上。



它确实完成了附加和生成正确的 file:/// X:/ Projects / contoso 。您可以在浏览器中键入此URL,它将打开目录。



但是,仅单击它会导致以下错误:




  • 不允许加载本地资源:$:// $ Chrome 73.0中的file:/// X:/ Projects / contoso

  • Edge 42(URI是 file:X:/ Projects / contoso ),但什么也不做

  • IE 11相同与Edge相同:URI相同,没有错误,没有任何反应

  • Firefox 66:相同...没有错误,没有任何反应; URI是 file:/// X:/ Projects / contoso



到很清楚:我不是在问为什么会出现错误或为什么它不起作用。从大量关于它的问题中可以很清楚地看出,这是几乎所有现代技术的安全功能。浏览器不加载本地资源。我得到了这么多。有些人建议设置一个Web服务器,但是我不确定如果我无法访问CRM Web服务器,那将如何工作。



还有哪些其他解决方案可以

解决方案

使用UNC资源与诸如Dynamics 365之类的跨浏览器Web平台的性质背道而驰。 Windows用户的笨拙体验显然无法正常工作,当他们尝试在浏览器中打开UNC路径时,请考虑Mac和移动用户的体验。



SharePoint将是显而易见的选择,但是如果您不愿使用SharePoint,那么您可能要考虑实施

这些天来,我怀疑许多人会认为WebDAV是一种现代或流行的解决方案用于D365文件集成。



在SharePoint之外, Azure Blob存储是一种可行且流行的基于云的选择。


In CRM we have a projects list and there are associated files with these projects on our network drive. Didn't want to setup Sharepoint due issues we have had with it in the past.

Anyway, in each of these project records we want to add the network URI for that project's files so the user can click on the link from the CRM record and be brought to that direct. So something like X:\Projects\contoso.

Came across this suggestion for accomplishing this:

http://blog.zealots.solar/?p=54

Basically consists of making an HTML page and inserting it as a web resource on the form, which makes it an iframe.

<html>
  <head>
    <meta charset="utf-8">
  </head>
  <body>
    <a id="doclink" style="border: 0px currentColor;" href="http://www.example.com" target="_blank">
      <img style="border: 0px currentColor;" src="stsr_folders_icon.png">
    </a>
    <script language="javascript" type="text/javascript">
      var linkval = window.parent.Xrm.Page.data.entity.attributes.get("stsr_documents").getValue();
      var a = document.getElementById('doclink');
      a.href = "file:"+linkval;
    </script>  
  </body>
</html>

Of course updating the window.parent.Xrm.Page.data.entity.attributes.get("stsr_documents") and the <img src=. It takes the URI values from the stsr_documents field and appends it to the image.

It does accomplish the appending and generating a correct file:///X:/Projects/contoso. You can type this URL into the browser and it will bring up the directory.

However, just clicking it results in the following errors:

  • Not allowed to load local resource: file:///X:/Projects/contoso in Chrome 73.0
  • No error in Edge 42 (URI is file:X:/Projects/contoso), but doesn't do anything at all
  • IE 11 same thing as Edge: same URI, no error, just nothing happens
  • Firefox 66: same... no error and nothing happens; URI is file:///X:/Projects/contoso

To be clear: I'm not asking why the error is coming up or why it isn't working. It is pretty clear from the abundance of questions regarding it that is a security feature of pretty much all modern browsers to not load local resources. That much I get.

What I'm wondering is what a work around is, if there is one. Some suggest setting up a web server, but I'm not sure how that would work given I don't have access to the CRM web server.

What other solutions might there be?

解决方案

Working with UNC resources is contrary to the nature of cross-browser web platform such as Dynamics 365. Along with the kludgy experience for Windows users, which apparently isn't working anyway, consider the experience for Mac and mobile users when they try to open a UNC path in their browser.

SharePoint would be the obvious choice, but with that off the table, you might want to look into implementing WebDAV on the server that's hosting the files.

These days I doubt that many would consider WebDAV to be a "modern" or popular solution for D365 file integration.

Outside of SharePoint, Azure Blob storage is a viable and popular cloud-based option.

这篇关于从Dynamics 365访问本地文件,并且不允许本地资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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