C # Cómo leer la ubicación de las plantillas de visualización en SharePoint 2013
-
10-12-2019 - |
Pregunta
Sharpeoint 2013 tiene una plantilla de filtro predeterminada ubicada en:
_catalogs/masterpage/Display%20Templates/Filters/Filter_Default.js
¿Cómo puedo leer la ruta absoluta de la maestra de _catalogs en C #?
Ejemplo de ruta absoluta: http://mymachine/_catalogs/masterpage/Display%20Templates/Filters/Filter_Default.js
Entonces, si cargaré este archivo en un elemento de script HTML, no obtendré un error 404 sin encontrado en el navegador:
<script type="text/javascript" src="http://mymachine/_catalogs/masterpage/Display%20Templates/Filters/Filter_Default.js">
</script>
Solución
Why would you not use the fact that _catalogs
is a virtual directory in SharePoint and reference it like this:
<scrit type="text/javascript" src="/_catalogs/15/masterpage/Display%20Templates/Filters/Filter_Default.js">
</script>
(notice the slash at first, and the 15 telling Sharepoint to look at the 15 hive instead of the 14 hive from 2010)
I also notice you have a typo in your "type" attribute (javscript instead of javascript)
Licenciado bajo: CC-BY-SA con atribución
No afiliado a sharepoint.stackexchange