DevicesManager.RemoveDevice Method (String, Guid)

 

Removes a device from the database.

Namespace:   Microsoft.WindowsServerSolutions.Common.Devices
Assembly:  DevicesOM (in DevicesOM.dll)

Syntax

public void RemoveDevice(
    string deviceId,
    Guid deviceType
)
public:
void RemoveDevice(
    String^ deviceId,
    Guid deviceType
)
Public Sub RemoveDevice (
    deviceId As String,
    deviceType As Guid
)

Parameters

  • deviceId
    Type: System.String

    The identifier of the device to be removed.

  • deviceType
    Type: System.Guid

    The type of the device to be removed.

Exceptions

Exception Condition
ArgumentNullException

The argument is null or empty.

ArgumentException

The deviceType is Guid.Empty.

DeviceIdDoesNotExistException

The deviceId does not exist in the devices provider.

DevicesProviderAccessDeniedException

The caller is not a local administrator.

DevicesProviderNotAvailableException

The object model is not connected to the devices provider.

DeviceTypeMismatchedException

The deviceType does not match the existing device.

DevicesProviderException

The reason the device could not be removed.

Remarks

Administrator rights are required to perform this operation.

Examples

The following code example shows how to remove a device from the database.

using (DevicesManager dm = new DevicesManager())
{
  string deviceId = Guid.NewGuid().ToString();
  Guid deviceType = Constant.MyDeviceType;
  dm.RemoveDevice(deviceId, deviceType);
  }

See Also

DevicesManager Class
Microsoft.WindowsServerSolutions.Common.Devices Namespace

Return to top