MdmAlert 类

定义

提供配置发送到移动设备管理服务器的数据的功能。

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
继承
Object Platform::Object IInspectable MdmAlert
属性

Windows 要求

设备系列
Windows 10 Creators Update (在 10.0.15063.0 中引入)
API contract
Windows.Foundation.UniversalApiContract (在 v4.0 中引入)

示例

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);
}

注解

MdmAlert 有两种用途:

  1. 启动 MdmSession 之前:创建警报并自定义警报参数。
  2. 启动 MdmSession 后:在会话中查询警报的结果,包括服务器为警报发送回的状态。

注意:通用警报 (1226) 最常见。

构造函数

MdmAlert()

包含自定义数据字段的 MDM 警报。

属性

Data

发送到服务器的自定义 MDM 数据。

Format

MDM 警报的数据格式。

Mark

警报的优先级或严重性。

Source

警报源的本地 URI 路径。

Status

服务器为响应警报而发送的只读状态代码。

Target

应用程序清单位置的本地 URI 路径。

Type

警报的类型。 这也是警报 ID。

适用于