IAccountServiceDeleteAccount Method

Deletes the account with the specified ID.

Namespace:  Dundas.BI.AccountServices
Assembly:  Dundas.BI.Core (in Dundas.BI.Core.dll) Version: 2.0.0.0 (24.4.0.1000)
Syntax
DeleteItemResult DeleteAccount(
	Guid id
)

Parameters

id
Type: SystemGuid
The ID of the account to delete.

Return Value

Type: DeleteItemResult
An object describing the result of the operation.
Exceptions
ExceptionCondition
ArgumentExceptionid is Empty.
NotFoundExceptionThe account with the specified ID does not exist.
NotSupportedExceptionThe operation is not supported by the underlying accounts provider.
NoPrivilegeException

The caller does not have system administration privileges.

-or-

The account is associated with a tenant, and the caller does not have administration privileges for that tenant.

InvalidOperationExceptionAn attempt was made to delete the built-in administrator account.
InvalidSessionExceptionThe caller context is not associated with a valid session.
Remarks
The account will be deleted together with any associated account-specific data (sessions, password reset requests, group membership) as well as the account's user project.
Examples

This example demonstrates how to create the Dundas BI engine, start the Dundas BI engine, log on, deletes an account with the ID = fdcb7aa9-8d5b-4a78-a9a6-745695928328, and then calls the shutdown engine method.

C#
using Dundas.BI;
using Dundas.BI.AccountServices;
using Dundas.BI.Services;
using System.Collections.ObjectModel;
   ...

// Create the engine.
EngineManager.CreateEngine(
    // Path to the application's data folder. Type: System.String
    @"C:\Program Files\Dundas Data Visualization Inc\Dundas BI\Instances\Instance1\www\BIWebsite\App_Data"
);

try
{
    // Start the Dundas BI Engine.
    EngineManager.StartEngine();

    // Create a caller context not associated with any session.
    using(Engine.Current.GetService<ICallerContextService>().CreateAndSetCurrentContext(null))
    {

        // LogOn.
        LogOnResult logOnResult = Engine.Current.GetService<ILogOnService>().LogOn(
            // The account name. Type: System.String
            "admin",
            // The password. Type: System.String
            "1234",
            // Delete other sessions for the logon to succeed. Type: System.Boolean
            true,
            // Culture to associate with the session, or null. Type: System.Globalization.CultureInfo
            null
        );

        // Set the current session ID.
        using(Engine.Current.GetService<ICallerContextService>().CurrentContext.SetCurrentSessionId(
            logOnResult.Session.Id
        );

        // Get the account service.
        IAccountService accountService =
            Engine.Current.GetService<IAccountService>();

        // Delete the account.
        accountService.DeleteAccount(new Guid("fdcb7aa9-8d5b-4a78-a9a6-745695928328"));

    }
}
finally
{
    EngineManager.ShutdownEngine();
}
See Also