DevicesManager.ReportDeviceProperties Method (String, IList<DeviceProperty>)
Reports the properties of a device.
Namespace: Microsoft.WindowsServerSolutions.Common.Devices
Assembly: DevicesOM (in DevicesOM.dll)
Syntax
public void ReportDeviceProperties(
string deviceId,
IList<DeviceProperty> properties
)
public:
void ReportDeviceProperties(
String^ deviceId,
IList<DeviceProperty^>^ properties
)
Public Sub ReportDeviceProperties (
deviceId As String,
properties As IList(Of DeviceProperty)
)
Parameters
deviceId
Type: System.StringThe identifier of the device to be reported.
properties
Type: System.Collections.Generic.IList<DeviceProperty>The properties of the device need to be reported.
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | The argument is null or empty. |
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.
This method is to report the properties of an existing device. Use the DevicePropertyFactory class to create device properties.
The Devices Provider is a local access only provider and cannot be accessed outside the server.
Examples
The following code example shows how to report device properties.
DevicesManager dm = new DevicesManager();
dm.Connect();
// create a device
Guid deviceType = DeviceTypes.Client;
string deviceId = Guid.NewGuid().ToString();
string deviceName = "SDK Device";
DeviceIdentityStatus status = DeviceIdentityStatus.Active;
string additionalInfo = null;
ReportDeviceParameters reportParameters =
new ReportDeviceParameters(deviceId, deviceName, status, additionalInfo);
dm.ReportDevice(deviceType, reportParameters);
// create properties
string os = "Windows Vista";
int spMajor = 2;
SystemType type = SystemType.AMD64;
OperatingSystemProperty operatingSystemProperty =
DevicePropertyFactory.CreateOperatingSystemProperty(os, spMajor, type);
int progress = 70;
bool hasBackup = false;
BackupStatusProperty backupStatusProperty =
DevicePropertyFactory.CreateBackupStatusProperty(progress, hasBackup);
IList<DeviceProperty> properties =
new List<DeviceProperty>(new DeviceProperty[] {
operatingSystemProperty, backupStatusProperty });
// report properties
dm.ReportDeviceProperties(deviceId, properties);
See Also
DevicePropertyFactory
DevicesManager Class
Microsoft.WindowsServerSolutions.Common.Devices Namespace
Return to top