Computing > 9 - Manipulation of Personal Templates > Delete a Personal Template

9.4 Delete a Personal Template

By using the Aruba WsEndUser method SetRemovePersonalTemplate it is possible to remove a personal template created by a user.
In the case of an Administrative user the method does not allow deletion if the template has been put for sale.
The method also deletes the file of the template from the FTP area of the user freeing the occupied space.

Parameters
templateID
Type: int
Int type item which contains the ID of the template.
Returns
The method returns a WsResult item containing information on the result of the call to the method.
//BaseWsEndUser.SetRemovePersonalTemplate Method (c# .NET) 
private static void SetRemovePersonalTemplate(WsEndUserClient client, int templateID)
{
    try
    {
        //call method SetRemovePersonalTemplate,
        //obtaining a WsResult item
        WsResult result = client.SetRemovePersonalTemplate(templateID);

        //if the call is not successful, re-run the error indicating the message
        if (!result.Success)
        {
            throw new ApplicationException(result.ResultMessage);
        }
    }
    catch (Exception ex)
    {
        //re-run the generic error
        Console.WriteLine(ex.Message);
    }
}
//BaseWsEndUser.setRemovePersonalTemplate Method (JAVA) 
private static void setRemovePersonalTemplate(IWsEndUser client, int templateID)
{
    try
    {
        //call method setRemovePersonalTemplate,
        //obtaining a WsResult item
        WsResult result = client.setRemovePersonalTemplate(templateID);

        //if the call is not successful, re-run the error indicating the message
        if (!result.isSuccess())
        {
            throw new Exception(result.getResultMessage());
        }
    }
    catch (Exception ex)
    {
        //generic exception
        System.out.println(ex);
    }
}
Version
API: v2.8 URL: https://api.dc1.computing.cloud.it/WsEndUser/v2.8/WsEndUser.svc?wsdl
See also