Partager via


DevicesManager.AuthoritativeRefreshDevices Method (Guid, IEnumerable<ReportDeviceParameters>, Boolean)

 

Refreshes the list of devices of the specified type.

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

Syntax

public void AuthoritativeRefreshDevices(
    Guid deviceType,
    IEnumerable<ReportDeviceParameters> parameters,
    bool updateWhenTypeConflict
)
public:
void AuthoritativeRefreshDevices(
    Guid deviceType,
    IEnumerable<ReportDeviceParameters^>^ parameters,
    bool updateWhenTypeConflict
)
Public Sub AuthoritativeRefreshDevices (
    deviceType As Guid,
    parameters As IEnumerable(Of ReportDeviceParameters),
    updateWhenTypeConflict As Boolean
)

Parameters

  • deviceType
    Type: System.Guid

    The type of devices that are managed by the authoritative source.

  • updateWhenTypeConflict
    Type: System.Boolean

    Controls whether an update is made to the type of the existing device. A conflict exists when a device that has the same identifier but a different device type is found in the devices provider.

Exceptions

Exception Condition
ArgumentException

The device type is Guid.Empty.

ArgumentNullException

ArgumentNullException is null.

DevicesProviderAccessDeniedException

The caller is not a local administrator.

DevicesProviderNotAvailableException

The object model is not connected to the devices provider.

DevicesProviderException

The reason that ReportDevice failed.

Remarks

The caller must be the Authoritative source that manages the devices of the specified type. If updateWhenTypeConflict is true, the devices provider will try to overwrite the existing device with mismatched type. If updateWhenTypeConflict is false, the mismatched device will be skipped.

Examples

The following code example shows an example of calling this method.

using (DevicesManager dm = new DevicesManager())
{
  dm.Connect();
  var paramList1 = new List<ReportDeviceParameters>();
  paramList1.Add(new ReportDeviceParameters("MyDevice1", 
                                            "My Device Name 1",
                                            DeviceIdentityStatus.Active,
                                            null));
  paramList1.Add(new ReportDeviceParameters("MyDevice2", 
                                            "My Device Name 2",
                                            DeviceIdentityStatus.Active,
                                            null));
  paramList1.Add(new ReportDeviceParameters("MyDevice3", 
                                            "My Device Name 3",
                                            DeviceIdentityStatus.Active,
                                            null));

  Guid deviceType = Constant.MyDeviceType;
  dm.AuthoritativeRefreshDevices(deviceType, paramList1, false);
}

See Also

DevicesManager Class
Microsoft.WindowsServerSolutions.Common.Devices Namespace

Return to top