Displaying AutoCAD drawings in SharePoint Search

Earlier this year Microsoft announced new integration with Autodesk AutoCAD for Microsoft OneDrive and SharePoint. We work with several clients who use AutoCAD drawings extensively, and this had previously been a major limitation of storing drawing files in SharePoint.

When a user navigates to a library, and selects a DWG file, the file opens in the AutoCAD preview app in the browser. (fig 1 and fig 2)


Fig 1 – SharePoint Library containing dwg files


Fig 2 – AutoCad preview from SharePoint Library

Unfortunately, SharePoint Search still does not open AutoCAD drawing files in the preview app. When the user clicks on a dwg result, the default experience if for the file to download (fig 3)


Fig 3 – AutoCad files are downloaded by default from SharePoint Search

We recently worked with a client who relies heavily on search, and AutoCAD files. By implementing a custom display template we were able to override the path url using the following code:

ctx.CurrentItem.Path = ctx.CurrentItem.ParentLink + “?id=” + ctx.CurrentItem.DefaultEncodingURL.replace(“https://tennantname.sharepoint.com”,””) + “&parent=na&parentview=7”;

Now when a user searches for a dwg file, and clicks on the result, they are taken to the AutoCAD preview app in the browser (fig 4 and fig 5).

Fig 4 – Search results after display template updated


Fig 5 – Search Preview after display template updated

If you store AutoCAD drawings in SharePoint and would like help to implement this in your SharePoint search site(s) then get in touch today for a free consultation.


Leave a Reply

Your email address will not be published. Required fields are marked *