{"id":443,"date":"2010-09-28T12:58:52","date_gmt":"2010-09-28T17:58:52","guid":{"rendered":"http:\/\/www.uv.mx\/personal\/gvera\/?p=443"},"modified":"2011-09-29T13:17:12","modified_gmt":"2011-09-29T18:17:12","slug":"sharepoint-pide-credenciales-al-acceder-archivos-en-una-biblioteca-de-documentos","status":"publish","type":"post","link":"https:\/\/www.uv.mx\/personal\/gvera\/2010\/09\/28\/sharepoint-pide-credenciales-al-acceder-archivos-en-una-biblioteca-de-documentos\/","title":{"rendered":"SharePoint pide credenciales al acceder archivos en una biblioteca de documentos"},"content":{"rendered":"<p style=\"text-align: center\"><a href=\"http:\/\/www.uv.mx\/personal\/gvera\/files\/2010\/09\/image1.png\"><img loading=\"lazy\" decoding=\"async\" style=\"border-width: 0px\" src=\"http:\/\/www.uv.mx\/personal\/gvera\/files\/2010\/09\/image_thumb.png\" alt=\"image\" width=\"329\" height=\"200\" border=\"0\" \/><\/a><\/p>\n<p style=\"text-align: right\">Espa\u00f1ol | <a title=\"Read this post in english\" href=\"http:\/\/www.uv.mx\/personal\/gvera\/2010\/09\/28\/sharepoint-login-prompt-when-accessing-files-in-a-document-library\/\">English<\/a><\/p>\n<p><span style=\"color: #993300\">No he actualizado esta versi\u00f3n. Pero puedes leerla en ingles actualizada 29-SEP-2011<\/span>. <a title=\"Read this post in english\" href=\"http:\/\/www.uv.mx\/personal\/gvera\/2010\/09\/28\/sharepoint-login-prompt-when-accessing-files-in-a-document-library\/\">Leerla actualizada pero en ingl\u00e9s.<\/a><\/p>\n<p>Hace tiempo que aqu\u00ed en la Universidad nos enfrentamos a un problema con cierta funcionalidad que traen los productos WSS, SharePoint Portal 2007 y SharePoint Server 2010.<\/p>\n<p>Como sabemos, para acceder a un sitio Web de SharePoint, debemos ingresar nuestras credenciales de la forma dominio\\username. Esto esta bien si el sitio no tiene el acceso an\u00f3nimo habilitado. \u00bfPero qu\u00e9 pasa cuando hacemos clic en un documento de Office (digamos un Word o Excel) de nuestra biblioteca de documentos?<\/p>\n<p><em>Cada vez que tratamos de abrir un documento, Office nos pregunta nuevamente por las credenciales una y otra vez. Esto pasa a\u00fan si el usuario es el creador del documento o el acceso an\u00f3nimo esta habilitado.<\/em><\/p>\n<p>\u00bfY qu\u00e9 tiene que decir al respecto Microsoft?<\/p>\n<blockquote><p>This is by design.<\/p><\/blockquote>\n<p>Referencias de este problema desde sitios de Microsoft:<\/p>\n<p><strong>Multiple Logon while open office Document from SharePoint<\/strong><br \/>\n<a title=\"http:\/\/blogs.technet.com\/b\/steve_chen\/archive\/2010\/06\/25\/multiple-logon-while-open-office-document-from-sharepoint.aspx\" href=\"http:\/\/blogs.technet.com\/b\/steve_chen\/archive\/2010\/06\/25\/multiple-logon-while-open-office-document-from-sharepoint.aspx\">http:\/\/blogs.technet.com\/b\/steve_chen\/archive\/2010\/06\/25\/multiple-logon-while-open-office-document-from-sharepoint.aspx<\/a><\/p>\n<p><strong>Office: Authentication prompts when opening Microsoft Office documents<\/strong><br \/>\n<a href=\"http:\/\/support.microsoft.com\/kb\/2019105\" target=\"_blank\">http:\/\/support.microsoft.com\/kb\/2019105<\/a><\/p>\n<p><strong>How documents are opened from a Web site in Office 2003<br \/>\n<\/strong><a href=\"http:\/\/support.microsoft.com\/kb\/838028\" target=\"_blank\">http:\/\/support.microsoft.com\/kb\/838028<\/a><\/p>\n<p>Acaso est\u00e1n locos?<\/p>\n<p>Lo que esta pasando es que Office esta tratando de ser muy inteligente y necesita saber quien eres para ofrecerte m\u00e1s funcionalidad para edici\u00f3n de contenido en l\u00ednea dentro de la suite de Office.<\/p>\n<p>&#8211; Yo: Esto esta bien, pero al menos dame la opci\u00f3n de deshabilitar eso desde la Administraci\u00f3n de SharePoint.<\/p>\n<p>&#8211; Office-SharePoint: No. No puedes.<\/p>\n<h4>Explanation of this behaviour<\/h4>\n<p>Well, if you try to open an Office file directly from a remote place, Office wants to know who the hell you are. If the server responses with the<\/p>\n<ul>\n<li><strong><em>Microsoft Office Protocol Discovery<\/em><\/strong> or a<\/li>\n<li><strong><em>FrontPage Protocol<\/em><\/strong> or a<\/li>\n<li><strong><em>WebDav Protocol<\/em><\/strong><\/li>\n<\/ul>\n<p>then it ask you for credentials. Not only Office does this. If you try to open a library as a HTTP SharePoint Folder View, Windows (something to do with how IE handles downloads) does the same. The request comes from one of these protocols so the Microsoft client app have to ask for credentials. It is by design.<\/p>\n<p>You can create an HttpModule that searchs for the <em>Request.UserAgent<\/em> string, so if you find one of these protocols, then send a 200 statuscode in the response. The problem here is that you are disabling not only logins prompts for documents, but for the entire client integration feature (opening files from Word, Excel or folder views in libraries). This is not what we want.<\/p>\n<p>We want to be able to use client integration, it&#8217;s a nice feature, but we do not want to be prompted inside our document libraries.<\/p>\n<h4>Soluci\u00f3n WSS &amp; SPS2007<\/h4>\n<p>Como he mencionado, no hay una soluci\u00f3n a este problema pues este comportamiento es por dise\u00f1o. Pero eso no va a detenernos, \u00bfo s\u00ed? Aqu\u00ed el workaround.<\/p>\n<p><!--more--><\/p>\n<p>Despu\u00e9s de buscar en la Web sin una soluci\u00f3n que realmente funcionara, decid\u00ed enfrentar el problema desde el punto de vista de un desarrollador Web. Si notamos, hay una opci\u00f3n dentro del men\u00fa contextual llamada \u201cEnviar a-&gt;Descargar una copia\u201d. Esta opci\u00f3n hace exactamente lo que queremos. It calls a file inside layouts folder called <em><strong>download.aspx<\/strong><\/em>. This file serves a SP file using:<\/p>\n<p>[js]Response.AddHeader(&quot;Content-Disposition&quot;, &quot;attachment;filename=&quot; + filename);[\/js]<\/p>\n<p>That&#8217;s why this option does not open the file directly on the server (the attachment string does it all).<\/p>\n<p><strong><em>The problem here is that this download.aspx file needs you to be authenticated. So if your site is anonymous, the option \u201cSent To-&gt;Download a Copy\u201d will ask you for credentials. It&#8217;s stupid I know, but it does. They fix this on SPS2010 though.<\/em><\/strong><\/p>\n<p>Don&#8217;t worry. We are going to handle the anonymous stuff later on.<\/p>\n<p style=\"text-align: center\"><a href=\"http:\/\/www.uv.mx\/personal\/gvera\/files\/2010\/09\/image2.png\"><img loading=\"lazy\" decoding=\"async\" style=\"border-width: 0px\" src=\"http:\/\/www.uv.mx\/personal\/gvera\/files\/2010\/09\/image_thumb1.png\" alt=\"image\" width=\"299\" height=\"132\" border=\"0\" \/><\/a><\/p>\n<p>Bueno, \u00bfy donde esta el c\u00f3digo que hace eso?<\/p>\n<p>Exacto. Como lo supones, esta en un archivo de Java Script llamado \u201cCORE.JS\u201d dentro de la carpeta C:\\Program Files\\Common Files\\Microsoft Shared\\web server extensions\\12\\template\\layouts\\[some numbers].<\/p>\n<p>1. Recuerda hacer un respaldo del archivo core.js.<\/p>\n<p>2. Busca esta l\u00ednea dentro del archivo CORE.JS:<\/p>\n<p>[js]function DispDocItemEx(ele, fTransformServiceOn, fShouldTransformExtension, fTransformHandleUrl, strProgId)[\/js]<\/p>\n<p>3. Agrega este c\u00f3digo justo debajo:<\/p>\n<p>[js]    \/\/ Agregado por Memo Vera para evitar que abra las App de Office.<br \/>\n    \/\/ 28 SEP 2010<br \/>\n    if (ctx.CurrentUserId &lt; 0) {<br \/>\n        \/\/ Si no vas a usar el http modulo para anonimos, comenta de aqui hasta donde dice Termina parte &#8230;<br \/>\n        var office_extensions = \/(.docx?|.pptx?|xlsx?|md[ab]|mp[pt])$\/i; \/\/ Modifica las extensiones de Office que quieras interceptar<br \/>\n        if (office_extensions.test(ele)) {<br \/>\n            STSNavigate(ctx.HttpRoot + &quot;\/_layouts\/download.aspx?SourceUrl=&quot; + ele);<br \/>\n            return false;<br \/>\n        }<br \/>\n        \/\/ Termina parte especial de modulo para anonimos.<br \/>\n        if (browseris.ie)<br \/>\n            event.cancelBubble = false;<br \/>\n        return true;<br \/>\n    }<br \/>\n    STSNavigate(ctx.HttpRoot + &quot;\/_layouts\/download.aspx?SourceUrl=&quot; + ele + &quot;&amp;Source=&quot; + GetSource());<br \/>\n    return false;<br \/>\n    \/\/ Termina agregado[\/js]<\/p>\n<p>Deja el resto de la funci\u00f3n como esta. No necesitamos cambiar nada m\u00e1s.<\/p>\n<p>No te preocupes, no necesitas reiniciar tu servidor de SharePoint u otro servicio. Tampoco necesitas agregar la URL de tu sitio de SharePoint a los Sitios de Confianza de IE (aunque siempre se recomienda hacerlo).<\/p>\n<p>Esto es todo. Actualiza tu p\u00e1gina Web y aseg\u00farate de limpiar el cache de tu navegador Web para que bajes la \u00faltima versi\u00f3n del archivo CORE.JS.<\/p>\n<p style=\"text-align: center\"><a href=\"http:\/\/www.uv.mx\/personal\/gvera\/files\/2010\/09\/image3.png\"><img loading=\"lazy\" decoding=\"async\" style=\"border-width: 0px\" src=\"http:\/\/www.uv.mx\/personal\/gvera\/files\/2010\/09\/image_thumb2.png\" alt=\"image\" width=\"595\" height=\"183\" border=\"0\" \/><\/a><\/p>\n<p>Tengo esto funcionando en mi ambiente de WSS 3.0 sin problemas. Todos andan felices, pueden usar la parte de integraci\u00f3n de clientes y esas peticiones por credenciales han desaparecido. Si queremos editar un documento en l\u00ednea usando Word, pues seleccionamos la opci\u00f3n \u201cEditar en Microsoft Word\u201d o abrimos el documento desde la aplicaci\u00f3n de Word.<\/p>\n<p style=\"text-align: center\"><a href=\"http:\/\/www.uv.mx\/personal\/gvera\/files\/2010\/09\/image4.png\"><img loading=\"lazy\" decoding=\"async\" style=\"border-width: 0px\" src=\"http:\/\/www.uv.mx\/personal\/gvera\/files\/2010\/09\/image_thumb3.png\" alt=\"image\" width=\"286\" height=\"120\" border=\"0\" \/><\/a><\/p>\n<h4>Anonymous sites on MOSS 2007 and WSS 3.0<\/h4>\n<p>Like I wrote before, we are using the <em>C:\\Program Files\\Common Files\\Microsoft Shared\\web server extensions\\12\\template\\layouts\\download.aspx<\/em> file witch is the one that serves files from SP content database. The problem with anonymous sites and this file, is that it needs you to be authenticated. As crazy as it might sound, it is true. Try it yourself on a clean SP box:<\/p>\n<p>Create an anonymous site, upload some Office documents and log off. Visit your site as anonymous and click on \u201cSent To-&gt;Download a Copy\u201d. The box will ask for your credentials. Just crazy.<\/p>\n<p><a href=\"http:\/\/www.uv.mx\/personal\/gvera\/files\/2010\/11\/image44.png\"><img loading=\"lazy\" decoding=\"async\" style=\"margin: 0px;padding-left: 0px;padding-right: 0px;padding-top: 0px;border-width: 0px\" src=\"http:\/\/www.uv.mx\/personal\/gvera\/files\/2010\/11\/image_thumb44.png\" alt=\"image\" width=\"475\" height=\"285\" border=\"0\" \/><\/a><\/p>\n<p>Microsoft fix this on SPS2010 though, so you do not need to do this on 2010 boxes.<\/p>\n<p>We are going to write an HTTP module that catches the authentication request when it comes from this <em>download.aspx<\/em> file and we will serve the file ourselves.<\/p>\n<p>1. I already created the module for you. You can download the compiled library and the source code here: <a title=\"Quita el Microsoft Office Protocol Discovery\" href=\"http:\/\/www.uv.mx\/personal\/gvera\/files\/2010\/11\/MemoQuitaMOPD.zip\" target=\"_blank\">MemoQuitaMOPD.zip<\/a><\/p>\n<p>Here you have the C# code:<\/p>\n<p>[csharp]<br \/>\nusing System;<br \/>\nusing System.Web;<br \/>\nusing System.Collections.Generic;<br \/>\nusing System.Text;<br \/>\nusing System.IO;<br \/>\nusing System.Net;<\/p>\n<p>namespace MemoQuitaMOPD<br \/>\n{<br \/>\n    public class MemoQuitaMOPD : IHttpModule<br \/>\n    {<br \/>\n        public void Init(HttpApplication context)<br \/>\n        {<br \/>\n            \/\/ Vamos a interferir justo despu\u00e9s de pedir la autenticacion<br \/>\n            context.PostAuthenticateRequest += new EventHandler(context_PostAuthenticateRequest);<br \/>\n        }<\/p>\n<p>        \/\/\/ &lt;summary&gt;<br \/>\n        \/\/\/ Esta se ejecuta justo despues de realizada la autenticacion.<br \/>\n        \/\/\/ Entonces ya sabemos quien es y podemos preguntar si esta autenticado.<br \/>\n        \/\/\/ &lt;\/summary&gt;<br \/>\n        \/\/\/ &lt;param name=&quot;sender&quot;&gt;&lt;\/param&gt;<br \/>\n        \/\/\/ &lt;param name=&quot;e&quot;&gt;Aqui viene la HttpApplication&lt;\/param&gt;<br \/>\n        void context_PostAuthenticateRequest(object sender, EventArgs e)<br \/>\n        {<br \/>\n            HttpApplication app = sender as HttpApplication;<br \/>\n            HttpContext context = app.Context;<br \/>\n            \/\/ Si no es anonimo, dejamos que SP trabaje normal<br \/>\n            if (context.User != null)<br \/>\n                if (context.User.Identity.IsAuthenticated)<br \/>\n                    return;<br \/>\n            \/\/ Es anonimo y ademas esta pidiendo la pagina download<br \/>\n            if (context.Request.RawUrl.ToString().IndexOf(&quot;download.aspx?SourceUrl&quot;) &gt;= 0)<br \/>\n            {<br \/>\n                if (String.IsNullOrEmpty(context.Request.QueryString[&quot;SourceUrl&quot;]) == false)<br \/>\n                {<br \/>\n                    WebClient client = new WebClient();<br \/>\n                    try<br \/>\n                    {<br \/>\n                        \/\/ Obtenemos la url<br \/>\n                        string url = context.Request.QueryString[&quot;SourceUrl&quot;];<br \/>\n                        if (url.IndexOf(&quot;http:\/\/&quot;) &lt; 0)<br \/>\n                            url = &quot;http:\/\/&quot; + context.Request.Url.Host + &quot;\/&quot; + url;<br \/>\n                        \/\/ Obtenemos el nombre del archivo<br \/>\n                        string filename = Path.GetFileName(context.Request.QueryString[&quot;SourceUrl&quot;]);<br \/>\n                        \/\/ SP reemplaza los espacios con guion bajo<br \/>\n                        filename = filename.Replace(&#8216; &#8216;, &#8216;_&#8217;);<br \/>\n                        \/\/ Descargamos nuestro archivo en nuestro arreglo de bytes.<br \/>\n                        byte[] myDataBuffer = client.DownloadData(url);<br \/>\n                        context.Response.ClearHeaders();<br \/>\n                        context.Response.ClearContent();<br \/>\n                        \/\/ Nombre del archivo para que el usuario no vea download.aspx en el cuadro de descarga<br \/>\n                        context.Response.AddHeader(&quot;Content-Disposition&quot;, &quot;attachment;filename=&quot; + filename);<br \/>\n                        context.Response.ContentType = &quot;application\/octet-stream&quot;;<br \/>\n                        \/\/ Para mis amigos de otros idiomas:<br \/>\n                        \/\/ You only need to especify this line if your installation is in Spanish like mine<br \/>\n                        \/\/ This handles special chars like \u00f1, \u00e1, \u00e9, etc.<br \/>\n                        context.Response.HeaderEncoding = Encoding.GetEncoding(&quot;iso-8859-1&quot;);<br \/>\n                        \/\/ Mandamos OK al browser y servimos nuestro archivo<br \/>\n                        context.Response.StatusCode = 200;<br \/>\n                        context.Response.BinaryWrite(myDataBuffer);<br \/>\n                    }<br \/>\n                    catch<br \/>\n                    {<br \/>\n                        \/\/ Si hay alg\u00fan error, mandamos un 404 NOT FOUND<br \/>\n                        context.Response.StatusCode = 404;<br \/>\n                    }<br \/>\n                    finally<br \/>\n                    {<br \/>\n                        client.Dispose();<br \/>\n                    }<br \/>\n                    context.Response.End();<br \/>\n                }<br \/>\n            }<br \/>\n        }<\/p>\n<p>        \/\/\/ &lt;summary&gt;<br \/>\n        \/\/\/ Esta funcion es por si quieres imprimir mensajes en un archivo de texto para depurar la aplicacion.<br \/>\n        \/\/\/ Por ejemplo si quieres ver que trae el URL: Log(context.Request.RawUrl.ToString(),app.Context);<br \/>\n        \/\/\/ &lt;\/summary&gt;<br \/>\n        \/\/\/ &lt;param name=&quot;mensaje&quot;&gt;Cadena a imprimir&lt;\/param&gt;<br \/>\n        \/\/\/ &lt;param name=&quot;context&quot;&gt;El app.Context que viene en context_AuthenticateRequest&lt;\/param&gt;<br \/>\n        public void Log(string mensaje, HttpContext context)<br \/>\n        {<br \/>\n            StreamWriter LogFile = null;<br \/>\n            try<br \/>\n            {<br \/>\n                LogFile = new StreamWriter(&quot;c:\\\\Inetpub\\\\wwwroot\\\\log.txt&quot;, true);<br \/>\n                LogFile.WriteLine(System.DateTime.Now.ToString(&quot;dd\/MM\/yyyy hh:mm:ss tt&quot;) + &quot; &#8211; &quot; + mensaje);<br \/>\n                LogFile.Close();<br \/>\n                LogFile.Dispose();<br \/>\n            }<br \/>\n            catch<br \/>\n            {<br \/>\n                \/\/No hace nada<br \/>\n            }<br \/>\n        }<\/p>\n<p>        public void Dispose()<br \/>\n        {<br \/>\n        }<br \/>\n    }<br \/>\n}<br \/>\n[\/csharp]<\/p>\n<p>2. If you trust me, you only need the file MemoQuitaMOPD.dll (It\u2019s already signed).<\/p>\n<p>Optional: If you want to make your it own, create a new Visual Studio 2010 Class Library Project and use the source file MemoQuitaMOPD.cs. Make changes if you like. Not need to put my name or whatever in it. It is for you.<\/p>\n<p><a href=\"http:\/\/www.uv.mx\/personal\/gvera\/files\/2010\/11\/image40.png\"><img loading=\"lazy\" decoding=\"async\" style=\"padding-left: 0px;padding-right: 0px;padding-top: 0px;border-width: 0px\" src=\"http:\/\/www.uv.mx\/personal\/gvera\/files\/2010\/11\/image_thumb40.png\" alt=\"image\" width=\"364\" height=\"302\" border=\"0\" \/><\/a><\/p>\n<p>3. Be careful here. We are going to add this library into the server GAC. Just log into your server and open the folder C:\\WINDOWS\\assembly. Drag and drop the MemoQuitaMOPD.dll library here (do not copy-paste, just drag). This way we have installed the library. Easy as cake.<\/p>\n<p><a href=\"http:\/\/www.uv.mx\/personal\/gvera\/files\/2010\/11\/image41.png\"><img loading=\"lazy\" decoding=\"async\" style=\"margin: 0px;padding-left: 0px;padding-right: 0px;padding-top: 0px;border-width: 0px\" src=\"http:\/\/www.uv.mx\/personal\/gvera\/files\/2010\/11\/image_thumb41.png\" alt=\"image\" width=\"475\" height=\"207\" border=\"0\" \/><\/a><\/p>\n<p>4. Let\u2019s make it available for SharePoint. Open your SharePoint Website configuration file. Usually in: C:\\Inetpub\\wwwroot\\web.config and find this lines:<\/p>\n<p>[xml]&lt;httpmodules&gt;<br \/>\n      &lt;clear \/&gt;<br \/>\n[\/xml]<\/p>\n<p>Add this line right after the clear tag:<\/p>\n<p>[xml]&lt;add name=&quot;MemoQuitaMOPD&quot; type=&quot;MemoQuitaMOPD.MemoQuitaMOPD, MemoQuitaMOPD, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9bef5ad97fb29b08&quot; \/&gt;[\/xml]<\/p>\n<p>If you made your own library, change the class name and namespace accordingly. Nice! Save your file.<\/p>\n<p>5. Try it! Visit your site anonymously and click on a file or use the option Sent To-&gt;Download a Copy\u201d.<\/p>\n<p><a href=\"http:\/\/www.uv.mx\/personal\/gvera\/files\/2010\/11\/image42.png\"><img loading=\"lazy\" decoding=\"async\" style=\"margin: 0px;padding-left: 0px;padding-right: 0px;padding-top: 0px;border-width: 0px\" src=\"http:\/\/www.uv.mx\/personal\/gvera\/files\/2010\/11\/image_thumb42.png\" alt=\"image\" width=\"475\" height=\"227\" border=\"0\" \/><\/a><\/p>\n<p>Beautiful, isn\u2019t it?<\/p>\n<p><a href=\"http:\/\/www.uv.mx\/personal\/gvera\/files\/2010\/11\/image43.png\"><img loading=\"lazy\" decoding=\"async\" style=\"margin: 0px;padding-left: 0px;padding-right: 0px;padding-top: 0px;border-width: 0px\" src=\"http:\/\/www.uv.mx\/personal\/gvera\/files\/2010\/11\/image_thumb43.png\" alt=\"image\" width=\"475\" height=\"134\" border=\"0\" \/><\/a><\/p>\n<p>At some point if you want to disable the module, just comment the line we added in the <em>web.config<\/em> and the ones marked in CORE.JS file. No harm done. <img decoding=\"async\" class=\"wlEmoticon wlEmoticon-openmouthedsmile\" style=\"border-style: none\" src=\"http:\/\/www.uv.mx\/personal\/gvera\/files\/2010\/11\/wlEmoticon-openmouthedsmile.png\" alt=\"Risa\" \/><\/p>\n<p><a href=\"http:\/\/www.uv.mx\/personal\/gvera\/files\/2010\/11\/image45.png\"><img loading=\"lazy\" decoding=\"async\" style=\"padding-left: 0px;padding-right: 0px;padding-top: 0px;border-width: 0px\" src=\"http:\/\/www.uv.mx\/personal\/gvera\/files\/2010\/11\/image_thumb45.png\" alt=\"image\" width=\"475\" height=\"149\" border=\"0\" \/><\/a><\/p>\n<h4>Soluci\u00f3n SharePoint Server 2010<\/h4>\n<p>En\u00a0SPS 2010 un poco diferente.<\/p>\n<p style=\"text-align: center\"><a href=\"http:\/\/www.uv.mx\/personal\/gvera\/files\/2010\/09\/1.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.uv.mx\/personal\/gvera\/files\/2010\/09\/1-300x119.jpg\" alt=\"\" width=\"300\" height=\"119\" \/><\/a><\/p>\n<p>Busca un archivo JavaScript\u00a0llamado \u201cinit.js\u201d qu\u00e9\u00a0est\u00e1 en\u00a0\\Program Files\\Common Files\\Microsoft Shared\\Web Server Extensions\\14\\TEMPLATE\\LAYOUTS\\1033.<\/p>\n<p>Las funciones dentro de este archivo se refieren al\u00a0core.js.\u00a0Este archivo\u00a0init.js\u00a0esta minified (viene de init.debug.js)\u00a0as\u00ed que no ser\u00e1 f\u00e1cil editarlo. Tienes que tener cuidado.<\/p>\n<p>1.\u00a0Realiza un respaldo de tu archivo\u00a0init.js.<\/p>\n<p>2.\u00a0Encuentra esta l\u00ednea en tu archivo\u00a0init.js:<\/p>\n<p>[js]<br \/>\nfunction DispEx(o,n,e,a,d,i,g,m,k,b,h,j,f,c,l){<br \/>\n[\/js]<\/p>\n<p>3. Agrega lo siguiente justo despu\u00e9s:<\/p>\n<p>[js]<br \/>\n\/*Agregado por Memo Vera para evitar que abra las App de Office. 18 NOV 2010.*\/STSNavigate(ctx.HttpRoot + &quot;\/_layouts\/download.aspx?SourceUrl=&quot; + o);return false;<br \/>\n[\/js]<\/p>\n<p>Deja el resto de la funci\u00f3n como est\u00e1. No hay necesidad de cambiar nada m\u00e1s.<\/p>\n<p style=\"text-align: center\"><a href=\"http:\/\/www.uv.mx\/personal\/gvera\/files\/2010\/09\/2.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.uv.mx\/personal\/gvera\/files\/2010\/09\/2-300x162.jpg\" alt=\"\" width=\"300\" height=\"162\" \/><\/a><\/p>\n<p>Esto aplica para todos los archivos de la suite de Office y tambi\u00e9n funciona con otros navegadores como FireFox:<\/p>\n<p style=\"text-align: center\"><a href=\"http:\/\/www.uv.mx\/personal\/gvera\/files\/2010\/09\/3.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.uv.mx\/personal\/gvera\/files\/2010\/09\/3-300x136.jpg\" alt=\"\" width=\"300\" height=\"136\" \/><\/a><\/p>\n<p>Espero que esto te ayude.<\/p>\n<h4>Problemas<\/h4>\n<p>Bueno, el \u00fanico problema que puedo pensar ahora mismo, es cuando una actualizaci\u00f3n o parche de SharePoint reemplace nuestro archivo core.js. No creo que sea mucho problema. A\u00f1adimos tan solo un par de lineas de c\u00f3digo. Ciertamente podemos ponerlas de vuelta.<\/p>\n<p>Claro que podemos hacer algo m\u00e1s elegante como programar un m\u00f3dulo que haga esto, cambiar nuestras master o layouts pages. Pero, en realidad, \u00bfpara que molestarse tanto? Tan s\u00f3lo queremos que cuando el usuario haga clic, descargue su documento (como deber\u00eda de ser). Algo tan simple, merece una soluci\u00f3n as\u00ed de simple.<\/p>\n<p>Encontr\u00e9 un detalle al usar el m\u00f3dulo con los nombres de archivo si usas caracteres como \u00f1, o acentos. En un rato libre tratar\u00e9 de corregir eso.<\/p>\n<p>Pru\u00e9balo y d\u00e9jame saber si te ha funcionado.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Espa\u00f1ol | English No he actualizado esta versi\u00f3n. Pero puedes leerla en ingles actualizada 29-SEP-2011. Leerla actualizada pero en ingl\u00e9s. Hace tiempo que aqu\u00ed en la Universidad nos enfrentamos a un problema con cierta funcionalidad que traen los productos WSS, SharePoint Portal 2007 y SharePoint Server 2010. Como sabemos, para acceder a un sitio Web&#8230;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10,21],"tags":[11,28,13],"class_list":["post-443","post","type-post","status-publish","format-standard","hentry","category-blog","category-sharepoint","tag-articulos-2","tag-sharepoint-2","tag-windows"],"_links":{"self":[{"href":"https:\/\/www.uv.mx\/personal\/gvera\/wp-json\/wp\/v2\/posts\/443","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.uv.mx\/personal\/gvera\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.uv.mx\/personal\/gvera\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.uv.mx\/personal\/gvera\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.uv.mx\/personal\/gvera\/wp-json\/wp\/v2\/comments?post=443"}],"version-history":[{"count":0,"href":"https:\/\/www.uv.mx\/personal\/gvera\/wp-json\/wp\/v2\/posts\/443\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.uv.mx\/personal\/gvera\/wp-json\/wp\/v2\/media?parent=443"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.uv.mx\/personal\/gvera\/wp-json\/wp\/v2\/categories?post=443"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.uv.mx\/personal\/gvera\/wp-json\/wp\/v2\/tags?post=443"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}