Deleting Document causes Custom Module Widget to Fail

Posted by Community Admin on 04-Aug-2018 19:59

Deleting Document causes Custom Module Widget to Fail

All Replies

Posted by Community Admin on 05-Apr-2013 00:00

I just had an instance where I have a custom module widget on a page that contains documents. One of those documents had been deleted in the backend and the widget was throwing an error while opening the page...

my code is like so...

var contentlinks = cdeapportionmentItem.GetValue("Attachment");
foreach (ContentLink cl in contentlinks as ContentLink[])

...
 var document = libraryManager.GetDocument(cl.ChildItemId);
...


Basically the custom module had the contentlink still in it, but there was no document to get based on the childitemid. and while getting the document, my logic threw an error.

Is there no way to prevent documents from being deleted if they are residing in custom modules?

This thread is closed