I need to find a way to remove old Layouts from my project if they were added before a certain date. I create layout templates and add them to my addin. These templates are then used to print a map, however, after it is loaded I stays with the project. I do want the layout to stay with the project (as load times are much faster), but when I update the Layout I want to remove the existing template if it is before a certain date that I maintain. I need to be able to get the date the existing Layout was added to the Projects catalog, then I will remove it based on this date if it is old.
<SPAN class="comment token">//Remove the old templates that might be out of date</SPAN>
<SPAN class="keyword token">foreach</SPAN> <SPAN class="punctuation token">(</SPAN>LayoutProjectItem layoutTemplate <SPAN class="keyword token">in</SPAN> Project<SPAN class="punctuation token">.</SPAN>Current<SPAN class="punctuation token">.</SPAN>GetItems<SPAN class="operator token"><</SPAN>LayoutProjectItem<SPAN class="operator token">></SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="punctuation token">{</SPAN>
<SPAN class="comment token">//NEED LOGIC HERE TO SEE IF THE layoutTemplate IS BEFORE a DATE</SPAN>
Project<SPAN class="punctuation token">.</SPAN>Current<SPAN class="punctuation token">.</SPAN><SPAN class="token function">RemoveItem</SPAN><SPAN class="punctuation token">(</SPAN>layoutTemplate <SPAN class="keyword token">as</SPAN> IProjectItem<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>