I want to find all items in my organization that have not been accessed or opened in say the last 6 months and delete them. I have some code here which gets the item ids, but it appears as if only the first item id is being passed and returning a data frame. Jake Skinner how can I grab every item id in my list and pass it to the usage method and if that item has no activity then delete it?
Here is the beginning of my code:
<SPAN class="keyword token">from</SPAN> arcgis<SPAN class="punctuation token">.</SPAN>gis <SPAN class="keyword token">import</SPAN> GIS<SPAN class="punctuation token">,</SPAN> Item
gis <SPAN class="operator token">=</SPAN> GIS<SPAN class="punctuation token">(</SPAN><SPAN class="string token">""</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">""</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">""</SPAN><SPAN class="punctuation token">)</SPAN>
my_content <SPAN class="operator token">=</SPAN> gis<SPAN class="punctuation token">.</SPAN>content<SPAN class="punctuation token">.</SPAN>search<SPAN class="punctuation token">(</SPAN>query<SPAN class="operator token">=</SPAN><SPAN class="string token">"owner:"</SPAN> <SPAN class="operator token">+</SPAN> gis<SPAN class="punctuation token">.</SPAN>users<SPAN class="punctuation token">.</SPAN>me<SPAN class="punctuation token">.</SPAN>username<SPAN class="punctuation token">,</SPAN>
max_items<SPAN class="operator token">=</SPAN><SPAN class="number token">15</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">for</SPAN> content <SPAN class="keyword token">in</SPAN> my_content<SPAN class="punctuation token">:</SPAN>
item_id <SPAN class="operator token">=</SPAN> content<SPAN class="punctuation token">.</SPAN>id
item <SPAN class="operator token">=</SPAN> Item<SPAN class="punctuation token">(</SPAN>gis<SPAN class="punctuation token">,</SPAN> item_id<SPAN class="punctuation token">)</SPAN>
itemid <SPAN class="operator token">=</SPAN> item<SPAN class="punctuation token">.</SPAN>id
chardata <SPAN class="operator token">=</SPAN> item<SPAN class="punctuation token">.</SPAN>usage<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"24H"</SPAN><SPAN class="punctuation token">,</SPAN>as_df<SPAN class="operator token">=</SPAN><SPAN class="token boolean">True</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">print</SPAN> <SPAN class="punctuation token">(</SPAN>chardata<SPAN class="punctuation token">)</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>