Share via


MdmAlert Class

Definition

Provides functionality to configure the data sent to the mobile device management server.

public ref class MdmAlert sealed
/// [Windows.Foundation.Metadata.Activatable(262144, "Windows.Foundation.UniversalApiContract")]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 262144)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class MdmAlert final
/// [Windows.Foundation.Metadata.Activatable(262144, "Windows.Foundation.UniversalApiContract")]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 262144)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Standard)]
class MdmAlert final
[Windows.Foundation.Metadata.Activatable(262144, "Windows.Foundation.UniversalApiContract")]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 262144)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class MdmAlert
[Windows.Foundation.Metadata.Activatable(262144, "Windows.Foundation.UniversalApiContract")]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 262144)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Standard)]
public sealed class MdmAlert
function MdmAlert()
Public NotInheritable Class MdmAlert
Inheritance
Object Platform::Object IInspectable MdmAlert
Attributes

Windows requirements

Device family
Windows 10 Creators Update (introduced in 10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v4.0)

Examples

void MultipleMdmAlerts()
{
    Log::Comment(WEX::Common::String().Format(L"Attempt to start syncing with two Alerts..."));
    Log::Comment(WEX::Common::String().Format(L"Fill in all members of first alert."));

    Windows::Management::MdmAlert myAlert;

    // This format is mandated by the OMA-DM standards for alerts.
    myAlert.Type(L"Reversed-Domain-Name:org.domain.samplealert");
    myAlert.Format(Windows::Management::MdmAlertDataType::String);
    myAlert.Data(L"alert-specific content.");
    myAlert.Mark(Windows::Management::MdmAlertMark::Critical);

    // Source and Target URIs are relative to the device, and typically in the MDM namespace.
    // Here, they indicate that an app was installed at "InstallSample", and the resulting
    // inventory location of the app is at "Results".
    myAlert.Source(L"./Vendor/MSFT/AppManagement/InstallSample");
    myAlert.Target(L"./Vendor/MSFT/AppManagement/Results");

    Windows::Management::MdmAlert myAlertNext;
    myAlertNext.Type(L"Reversed-Domain-Name:org.domain.nextalert");

    std::vector<Windows::Management::MdmAlert> alertList;

    alertList.push_back(myAlert);
    alertList.push_back(myAlertNext);
}
void MultipleMdmAlerts() 
{
    Log::Comment(WEX::Common::String().Format(L"Attempt to start syncing with two Alerts..."));
    Log::Comment(WEX::Common::String().Format(L"Fill in all members of first alert."));

    Windows::Management::MdmAlert^ myAlert = ref new Windows::Management::MdmAlert();

    // This format is mandated by the OMA-DM standards for alerts.
    myAlert->Type = ref new Platform::String(L"Reversed-Domain-Name:org.domain.samplealert");
    myAlert->Format = Windows::Management::MdmAlertDataType::String;
    myAlert->Data = ref new Platform::String(L"alert-specific content.");
    myAlert->Mark = Windows::Management::MdmAlertMark::Critical;

    // Source and Target URIs are relative to the device and typically in the MDM namespace.
    // Here, they indicate that an app was installed at "InstallSample" and the resulting
    // inventory location of the app is at "Results".
    myAlert->Source = ref new Platform::String(L"./Vendor/MSFT/AppManagement/InstallSample");
    myAlert->Target = ref new Platform::String(L"./Vendor/MSFT/AppManagement/Results");

    Windows::Management::MdmAlert^ myAlertNext = ref new Windows::Management::MdmAlert();
    myAlertNext->Type = ref new Platform::String(L"Reversed-Domain-Name:org.domain.nextalert");

    Windows::Foundation::Collections::IVector<MdmAlert^>^ alertList = ref new Platform::Collections::Vector<MdmAlert^>();

    alertList->Append(myAlert);
    alertList->Append(myAlertNext);
}

Remarks

There are two uses of MdmAlert:

  1. Before you start an MdmSession: Create an alert and customize the alert parameters.
  2. After you start an MdmSession: Query the session for results from the alert, including status sent back by the server for the alert.

Note: The generic alert (1226) is most common.

Constructors

MdmAlert()

An MDM alert with custom data fields.

Properties

Data

Custom MDM data sent to the server.

Format

The data format of the MDM alert.

Mark

The priority or criticality of the alert.

Source

The local URI path to the source of the alert.

Status

A read-only status code sent by the server in response to the alert.

Target

The local URI path to the inventory location of the application.

Type

The type of the alert. This is also the alert ID.

Applies to