Friday 31 January 2014

TeamMentor TBot page to delete articles based on list of Guids

Continuing on the thread where I'm helping Serge to prune the TeamMentor's ASP.NET 3.5 library (see here, here and here for how I set-up the current test environment), one of his requirements was to be able to batch delete TeamMentor articles based on a list of GUIDs.

Without touching the 3.4 codebase I was able to add a new TBot Admin page with this feature (which is quite a cool 3.4 TeamMentor capability that I will blog about in a different post).

As with the previous examples, the TBot Script, called Delete_Articles_By_Guid.cshtml was developed on a GitHub hosted, TeamMentor UserData Repo:

The deployment/sync of this script was done via the Reload UserData button (which is quite fast since it doesn't rebuild the cache objects):

After the sync, the link to the new TBot page will appear in the _Misc section of the main TBot screen:

When opened, the Delete_Articles_By_Guid page will look like this (hopefully the functionality is quite obvious)

To test this out, lets go into the main TeamMentor instance:

... right-click on the library tree and select Open Edit Mode option

 ... right-click again on the library to add the test article, and chose the Add Guidance Item option

This will open up a popup window where we can enter some test and metadata:

After saving it, copy the GUID

Which is then pasted in the Delete_Articles_By_Guid TextBox (we can delete more than one by putting one GUID per line)

After clicking on Delete Articles the result will be shown on the green Result section (note that this only flags if there were major errors (i.e. at the moment missing GUIDs will not be reported))

We can double check that the article doesn't exist any more by trying to open that page :

The TBot debug messages should also have an removing GuidanceItem with Id: {GUID} entry: