This blog is about how to get a DWG thumbnail in SharePoint similar to Windows Explorer.

Task

When you drop AutoCAD drawings into SharePoint, they are displayed in the document library only with a small icon.

DWG Thumbnail in SharePoint - Without Thumbnail

This is not very practical and we want to customize the behavior similar to Windows Explorer. There, a thumbnail of the drawing is displayed instead of the icon.

DWG Thumbnail in SharePoint - DWG Thumbnail in Windows Explorer

Solution

To make this possible, a new “ThumbnailLink” property must first be created in the document library. The link to the preview image is then stored in this.

Generating the thumbnail from the DWG file was resolved using the Drawings SDK from Open Design alliance.

Here, however, you have to be careful which version you are using, as this is only for certain .Net frameworks. A listing can be found here.

Because the thumbnail must be recreated after each change to the drawing, an Event Receiver is used. After each change, the thumbnail is recreated and adjusts the link in “ThumbnailLink” if none is stored yet.

To display the image in the document library, client side rendering is used as well as in the article“Image Gallery in SharePoint Image Library“.

To do this, edit the view in the document library and link a JavaScript file to the properties under JS-Link.

DWG Thumbnail in SharePoint - WebPart Settings JSLink

In this JS file, all you need to do is replace the link with an image tag. Exactly how this works is well described here.

Result

If you have done everything right, you will get the following result.

DWG Thumbnail in SharePoint - SharePoint DWG with Thumbnail

If you have a question about how to create a DWG thumbnail in SharePoint, leave a comment or just write me an email.

I’m looking forward to helping you so that you and your users love SharePoint too!