View Office documents in browser

Forums vLooup for SharePoint View Office documents in browser

This topic contains 1 reply, has 2 voices, and was last updated by  Alexander Bautz 2 weeks, 6 days ago.

  • Author
    Posts
  • #18570

    Ivan Wilson
    Participant

    Is it possible to configure vLookup running in Office 365 to display Microsoft Office files in the browser (new tab)? Currently they are downloading to the local computer

  • #18584

    Alexander Bautz
    Keymaster

    Hi,
    You can add this code to the Custom JS in DFFS:

    function openWordAndExcelFilesInBrowser(a,item){
        var docName = item.get_item("FileLeafRef");
        var link = makeAbsUrl(item.get_item("FileDirRef") + "/" + docName);
    	switch(item.get_item("DocIcon").toLowerCase()){
    		case "docx":
    		case "xlsx":
    			a = "<a href='"+_spPageContextInfo.webServerRelativeUrl+"/_layouts/15/WopiFrame.aspx?sourcedoc={A9149557-15AB-49B6-8294-AAC3C0C3FE7A}&file="+docName+"&action=default' target='_blank'>"+docName+"</a>";
    		break;
    	}
    	return a;
    }

    You must change “{A9149557-15AB-49B6-8294-AAC3C0C3FE7A}” with the GUID of the document library where the documents are located.

    Then use this in the “Special configuration” for the field “FileLeafRef” in the viewfields section in vLookup config:

    {"function":"openWordAndExcelFilesInBrowser"}

    Let me know how this works out.

    Alexander

You must be logged in to reply to this topic.