Sharepoint 2003: Auto Open List Attachment


Actually this is a query from one of our client. They ask me how to make some list items automatically open its attachment. Although this can be done programatically, but I prefer Javascript approach.

Many task in web application can be accomplished using Javascript. Sharepoint using Javascript to create dynamic view for the users. For example you open DispForm.aspx of a list, it will dynamically hide/show Attachments information. Here you can see two item list, the first list has an attachment while the other hasn't any.


List item with attachment will show, Attachments row just like this picture,


while list item without attachment will hide the Attachments row.


It all provided by Sharepoint using simple Javascript that checks whether “idAttachmentsTable” object has rows defined. If that object has zero length rows, then it has no attachment. Hence, by checking “idAttachmentsTable” object and digging to url child nodes we can grab location of the attachment. Passing the location of the attachment to document location will then open list item attachment automatically.

So, start to open DispForm.aspx of the list, and insert custom javascript just above closing tag.


Save the modification, and if you click on list item with attachment, it will open the attachment automatically.


Riwut Libinuko
Sr. Cloud Solution Architect

My research interests include distributed robotics, mobile computing and programmable matter.

comments powered by Disqus