My SharePoint Blog

Blogs On SharePoint Technologies


Search Site


My SharePoint Blog recommends any of the following books...


Recent comments

Tags

Don't show

    Categories


    Disclaimer

    The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

    © Copyright 2008

    Suppress Microsoft Office Document Authentication Prompt In SharePoint WSS 3.0

    Problem: Clicking a Microsoft Office document (Word, Excel, PowerPoint, etc) in a document library re-challenges for authentication on a secure site.

    Reason: By default when you click the document name or icon you are re-challenged for your log-on credentials because the document is passed to Office for handling. Office cannot retrieve the session cookie from IE because it is in a separate process. This is a nuisance for most users because they are not interested in editing the document in the first place and they don't know that it is possible to...  Hover the item --> Select the drop down --> Send To --> Download A Copy

    This will download the file without the Office/SharePoint hooks for editing. This is not a user friendly way to view a document.

     

    My Desired Goal: Have the link open the document directly.

     

    Fix:

    Backup and Open: C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\1033\CORE.JS

    Find:

    function DispDocItemEx(ele, fTransformServiceOn,
         fShouldTransformExtension, fTransformHandleUrl, strProgId)
    {

    Add below:

    /*************************************************************
    Suppress Document Authentication Prompt Mod for WSS 3.0
    by Kevin Cornwell 2/28/2007
     
    Open document without SharePoint hook to edit,
    thus suppressing the authentication prompt.
    *************************************************************/
     
    var _ele;
     
    if (_ele = ele.toString()){
     
        if (_ele_ext = _ele.substring(_ele.lastIndexOf('.')+1).toLowerCase()){
     
            /* list of office docs */
            var arr_office_ext = new Array('doc','xls','dot','bmp','gif','jpeg',
                                           'jpg','csv','docm','docx','docmhtml',
                                           'docxml','dothtml','gcsx','ico','mdb',
                                           'mde','mdn','png','pot','pothtml','potm',
                                           'potx','pps','ppt','pptm','pptx','pub',
                                           'xlb','xlc','xls','xlsm','xlt','xltm',
                                           'xltx','xlw','xlxml');
            var _i;
            var b_office_doc = false;
     
            /* check for ext in array */
            for (_i=0; _i < arr_office_ext.length; _i++) {
                if (arr_office_ext[_i] === _ele_ext){
                    //alert(_ele);
                    b_office_doc = true;
                break;
                }
            }
     
            /* send only if office ext */
            if (b_office_doc){
     
                /* Open the doc via download.aspx (supress sp editing) */
                     STSNavigate(ctx.HttpRoot + '/_layouts/download.aspx?SourceUrl=' + _ele);
     
                /* Kill the “regular” sp handling of the doc (edit mode)
                   onClick(true) and simply download the doc. */
                return false;
            }       
        }
    }
     
     
    /* End mod ***************************************************/

    Restart your browser and test. To clear the browser cache, click CTRL + F5.

     

    Notes: You will still have the capability to edit/save to the SharePoint site directly:    Hover the item --> Select the drop down --> Edit in Microsoft X.  Not tested in any other flavor of SharePoint.


    Categories: SharePoint
    Posted by Kevin on Wednesday, February 28, 2007 1:02 PM
    Permalink | Comments (2) | Post RSSRSS comment feed

    Comments

    kk

    Friday, March 21, 2008 3:48 PM

    Thanks! Unlike most MOSS installs, I have to deal with hundreds of non-domain computers and users and unknown client Office versions/installs. This saved me a lot of grief.

    Kevin

    Friday, March 21, 2008 4:45 PM

    Your welcom kk.

    This was my first SharePoint hack. My peeps love it. One less prompt to deal with.

    Add comment


     

    [b][/b] - [i][/i] - [u][/u]- [quote][/quote]



    Live preview

    Thursday, November 20, 2008 6:38 PM