列出 Windows 设置
本文内容
命名空间:microsoft.graph
重要
Microsoft Graph /beta
版本下的 API 可能会发生更改。 不支持在生产应用程序中使用这些 API。 若要确定 API 是否在 v1.0 中可用,请使用 版本 选择器。
获取已登录用户的 windowsSetting 对象及其属性的列表。
此 API 可用于以下国家级云部署 。
全局服务
美国政府 L4
美国政府 L5 (DOD)
由世纪互联运营的中国
✅
❌
❌
❌
权限
为此 API 选择标记为最低特权的权限。 只有在应用需要它时 ,才使用更高的特权权限。 有关委派权限和应用程序权限的详细信息,请参阅权限类型 。 要了解有关这些权限的详细信息,请参阅 权限参考 。
权限类型
最低特权权限
更高特权权限
委派(工作或学校帐户)
UserWindowsSettings.Read
不可用。
委派(个人 Microsoft 帐户)
UserWindowsSettings.Read
不可用。
应用程序
不支持。
不支持。
HTTP 请求
GET /me/settings/windows
可选的查询参数
此方法支持 $filter
OData 查询参数来帮助自定义响应。 若要了解一般信息,请参阅 OData 查询参数 。
可以按以下属性筛选结果:
windowsDeviceId :表示 Windows 设备的唯一标识符的字符串值。 可以在响应正文中找到此标识符。 在 windowsDeviceId 上进行筛选时,可以获取特定于该设备的设置列表。 此参数仅支持相等 (eq
) 比较。
settingType :具有以下有效值的枚举: roaming
和 backup
。 settingType 属性允许将结果缩小到与漫游或备份相关的设置。 此参数仅支持相等 (eq
) 比较。 有关详细信息,请参阅 windowsSettingType 。
有关如何使用此查询参数的更多详细信息,请参阅 示例 部分。
名称
说明
Authorization
持有者 {token}。 必填。 详细了解 身份验证和授权 。
Prefer
可选。 出于分页目的,此 API 通过此标头支持 odata.maxpagesize 参数。 odata.maxpagesize 的最小和最大有效值分别为 1 和 200 。 如果未传递任何值,则默认值为 110 。
请求正文
请勿提供此方法的请求正文。
响应
如果成功,此方法在响应正文中返回响应 200 OK
代码和 windowsSetting 对象的集合。
如果响应包含多页数据,则响应正文将包含属性 @odata.nextLink
。 此属性将包含可用于请求下一页数据的 URL。 应在不进行任何修改的情况下使用该 URL。
示例
示例 1:不带任何筛选器的请求
请求
以下示例显示了一个请求。
GET https://graph.microsoft.com/beta/me/settings/windows
// Code snippets are only available for the latest version. Current version is 5.x
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Me.Settings.Windows.GetAsync();
// THE CLI IS IN PREVIEW. NON-PRODUCTION USE ONLY
mgc-beta users settings windows list --user-id {user-id}
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
//other-imports
)
graphClient := msgraphsdk.NewGraphServiceClientWithCredentials(cred, scopes)
windows, err := graphClient.Me().Settings().Windows().Get(context.Background(), nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
WindowsSettingCollectionResponse result = graphClient.me().settings().windows().get();
const options = {
authProvider,
};
const client = Client.init(options);
let windows = await client.api('/me/settings/windows')
.version('beta')
.get();
<?php
use Microsoft\Graph\GraphServiceClient;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$result = $graphServiceClient->me()->settings()->windows()->get()->wait();
Import-Module Microsoft.Graph.Beta.Users
# A UPN can also be used as -UserId.
Get-MgBetaUserSettingWindows -UserId $userId
from msgraph import GraphServiceClient
graph_client = GraphServiceClient(credentials, scopes)
result = await graph_client.me.settings.windows.get()
响应
以下示例显示了相应的响应。
注意: 为了提高可读性,可能缩短了此处显示的响应对象。
HTTP/1.1 200 OK
Content-Type: application/json
{
"value": [
{
"@odata.type": "#microsoft.graph.windowsSetting",
"id": "default$windows.data.fileexplorerclassic.searchsettings",
"windowsDeviceId": "c9e0f7d8-2b1a-4f6e-9b7c-8e3a1a3e5b0d",
"settingType": "backup",
"payloadType": "windows.data.fileexplorerclassic.searchsettings",
"instances": [
{
"id": "9715f1d9-49d1-4b94-041b-443ac419d417",
"payload": "VGhpcyBpcyBqdXN0IGFuIGV4YW1wbGUh",
"lastModifiedDateTime": "2024-10-31T23:30:41Z",
"createdDateTime": "2024-02-12T19:34:35.223Z",
"expirationDateTime": "2034-02-09T19:34:33.771Z"
}
]
},
{
"@odata.type": "#microsoft.graph.windowsSetting",
"id": "default$windows.data.input.devices.pensyncedsettings",
"windowsDeviceId": "a4b9d6e7-8f3c-4d2a-b1e0-6c5f0e9a7d8b",
"settingType": "backup",
"payloadType": "windows.data.input.devices.pensyncedsettings",
"instances": [
{
"id": "666dcb9b-49d1-4b94-041b-443ac419d417",
"payload": "VGhpcyBpcyBhbm90aGVyIGp1c3QgYW4gZXhhbXBsZSE=",
"lastModifiedDateTime": "2024-10-31T23:30:41Z",
"createdDateTime": "2024-02-12T19:34:35.223Z",
"expirationDateTime": "2034-02-09T19:34:33.771Z"
}
]
}
],
"@odata.nextLink": "https://graph.microsoft.com/beta/me/settings/windows?$skiptoken=eyJzZXRhZyI6ImJmY2I2ZjQwLWM5ZGQtMTFlZS05MTE3LTAxMDIwMzA1MDcwZCIsImlldGFnIjoiMDAwMDAwMDAtMDAwMC0wMDAwLTAwMDAtMDAwMDAwMDAwMDAwIiwiZW5kRVRhZyI6IjEwMDJkOGYwLWM2NTItMTRkYy05MTE3LTAxMDIwMzA1MDcwZCIsImV0YWciOiJjMDMzZjUxMC1jOWRkLTExZWUtOTExNy0wMTAyMDMwNTA3MGQiLCJsdHNsIjoiYzAzM2Y1MTAtYzlkZC0xMWVlLTkxMTctMDEwMjAzMDUwNzBkIiwibmV4dCI6dHJ1ZX0%3d"
}
示例 2:请求并按 settingType 筛选roaming
请求
以下示例显示了一个请求。
GET https://graph.microsoft.com/beta/me/settings/windows?$filter=settingType eq 'roaming'
// Code snippets are only available for the latest version. Current version is 5.x
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Me.Settings.Windows.GetAsync((requestConfiguration) =>
{
requestConfiguration.QueryParameters.Filter = "settingType eq 'roaming'";
});
// THE CLI IS IN PREVIEW. NON-PRODUCTION USE ONLY
mgc-beta users settings windows list --user-id {user-id} --filter "settingType eq 'roaming'"
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphusers "github.com/microsoftgraph/msgraph-beta-sdk-go/users"
//other-imports
)
graphClient := msgraphsdk.NewGraphServiceClientWithCredentials(cred, scopes)
requestFilter := "settingType eq 'roaming'"
requestParameters := &graphusers.ItemSettingsWindowsRequestBuilderGetQueryParameters{
Filter: &requestFilter,
}
configuration := &graphusers.ItemSettingsWindowsRequestBuilderGetRequestConfiguration{
QueryParameters: requestParameters,
}
windows, err := graphClient.Me().Settings().Windows().Get(context.Background(), configuration)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
WindowsSettingCollectionResponse result = graphClient.me().settings().windows().get(requestConfiguration -> {
requestConfiguration.queryParameters.filter = "settingType eq 'roaming'";
});
const options = {
authProvider,
};
const client = Client.init(options);
let windows = await client.api('/me/settings/windows')
.version('beta')
.filter('settingType eq \'roaming\'')
.get();
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Users\Item\Settings\Windows\WindowsRequestBuilderGetRequestConfiguration;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestConfiguration = new WindowsRequestBuilderGetRequestConfiguration();
$queryParameters = WindowsRequestBuilderGetRequestConfiguration::createQueryParameters();
$queryParameters->filter = "settingType eq 'roaming'";
$requestConfiguration->queryParameters = $queryParameters;
$result = $graphServiceClient->me()->settings()->windows()->get($requestConfiguration)->wait();
Import-Module Microsoft.Graph.Beta.Users
# A UPN can also be used as -UserId.
Get-MgBetaUserSettingWindows -UserId $userId -Filter "settingType eq 'roaming'"
from msgraph import GraphServiceClient
from msgraph.generated.users.item.settings.windows.windows_request_builder import WindowsRequestBuilder
graph_client = GraphServiceClient(credentials, scopes)
query_params = WindowsRequestBuilder.WindowsRequestBuilderGetQueryParameters(
filter = "settingType eq 'roaming'",
)
request_configuration = WindowsRequestBuilder.WindowsRequestBuilderGetRequestConfiguration(
query_parameters = query_params,
)
result = await graph_client.me.settings.windows.get(request_configuration = request_configuration)
响应
以下示例显示了相应的响应。
注意: 为了提高可读性,可能缩短了此处显示的响应对象。
HTTP/1.1 200 OK
Content-Type: application/json
{
"value": [
{
"@odata.type": "#microsoft.graph.windowsSetting",
"id": "default$windows.data.fileexplorerclassic.shellstatesettings",
"settingType": "roaming",
"payloadType": "windows.data.fileexplorerclassic.shellstatesettings",
"instances": [
{
"id": "0b3af867-49d1-4b94-041b-443ac419d417",
"payload": "VGhpcyBpcyBqdXN0IGFuIGV4YW1wbGUh",
"lastModifiedDateTime": "2024-10-31T23:30:41Z",
"createdDateTime": "2024-02-12T19:34:35.223Z",
"expirationDateTime": "2034-02-09T19:34:33.771Z"
}
]
},
{
"@odata.type": "#microsoft.graph.windowsSetting",
"id": "default$windows.data.fileexplorerclassic.cabinetstatesettings",
"settingType": "roaming",
"payloadType": "windows.data.fileexplorerclassic.cabinetstatesettings",
"instances": [
{
"id": "5038fa1b-49d1-4b94-041b-443ac419d417",
"payload": "VGhpcyBpcyBhbm90aGVyIGp1c3QgYW4gZXhhbXBsZSE=",
"lastModifiedDateTime": "2024-10-31T23:30:41Z",
"createdDateTime": "2024-02-12T19:34:35.223Z",
"expirationDateTime": "2034-02-09T19:34:33.771Z"
}
]
}
]
}
示例 3:按 backup
settingType 筛选的请求
请求
以下示例显示了一个请求。
GET https://graph.microsoft.com/beta/me/settings/windows?$filter=settingType eq 'backup'
// Code snippets are only available for the latest version. Current version is 5.x
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Me.Settings.Windows.GetAsync((requestConfiguration) =>
{
requestConfiguration.QueryParameters.Filter = "settingType eq 'backup'";
});
// THE CLI IS IN PREVIEW. NON-PRODUCTION USE ONLY
mgc-beta users settings windows list --user-id {user-id} --filter "settingType eq 'backup'"
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphusers "github.com/microsoftgraph/msgraph-beta-sdk-go/users"
//other-imports
)
graphClient := msgraphsdk.NewGraphServiceClientWithCredentials(cred, scopes)
requestFilter := "settingType eq 'backup'"
requestParameters := &graphusers.ItemSettingsWindowsRequestBuilderGetQueryParameters{
Filter: &requestFilter,
}
configuration := &graphusers.ItemSettingsWindowsRequestBuilderGetRequestConfiguration{
QueryParameters: requestParameters,
}
windows, err := graphClient.Me().Settings().Windows().Get(context.Background(), configuration)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
WindowsSettingCollectionResponse result = graphClient.me().settings().windows().get(requestConfiguration -> {
requestConfiguration.queryParameters.filter = "settingType eq 'backup'";
});
const options = {
authProvider,
};
const client = Client.init(options);
let windows = await client.api('/me/settings/windows')
.version('beta')
.filter('settingType eq \'backup\'')
.get();
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Users\Item\Settings\Windows\WindowsRequestBuilderGetRequestConfiguration;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestConfiguration = new WindowsRequestBuilderGetRequestConfiguration();
$queryParameters = WindowsRequestBuilderGetRequestConfiguration::createQueryParameters();
$queryParameters->filter = "settingType eq 'backup'";
$requestConfiguration->queryParameters = $queryParameters;
$result = $graphServiceClient->me()->settings()->windows()->get($requestConfiguration)->wait();
Import-Module Microsoft.Graph.Beta.Users
# A UPN can also be used as -UserId.
Get-MgBetaUserSettingWindows -UserId $userId -Filter "settingType eq 'backup'"
from msgraph import GraphServiceClient
from msgraph.generated.users.item.settings.windows.windows_request_builder import WindowsRequestBuilder
graph_client = GraphServiceClient(credentials, scopes)
query_params = WindowsRequestBuilder.WindowsRequestBuilderGetQueryParameters(
filter = "settingType eq 'backup'",
)
request_configuration = WindowsRequestBuilder.WindowsRequestBuilderGetRequestConfiguration(
query_parameters = query_params,
)
result = await graph_client.me.settings.windows.get(request_configuration = request_configuration)
响应
以下示例显示了相应的响应。
注意: 为了提高可读性,可能缩短了此处显示的响应对象。
HTTP/1.1 200 OK
Content-Type: application/json
{
"value": [
{
"@odata.type": "#microsoft.graph.windowsSetting",
"id": "{67585f9f-ee4b-4dd8-808e-d88375d66ef7}$windows.data.apps.devicemetadata",
"windowsDeviceId": "67585f9f-ee4b-4dd8-808e-d88375d66ef7",
"settingType": "backup",
"payloadType": "windows.data.apps.devicemetadata",
"instances": [
{
"id": "14b50191-10e5-4da5-9099-8c909b8458bd",
"payload": "VGhpcyBpcyBhbm90aGVyIGp1c3QgYW4gZXhhbXBsZSE=",
"lastModifiedDateTime": "2024-10-31T23:30:41Z",
"createdDateTime": "2024-02-12T19:34:35.223Z",
"expirationDateTime": "2034-02-09T19:34:33.771Z"
}
]
},
{
"@odata.type": "#microsoft.graph.windowsSetting",
"id": "{55f26da7-5824-4937-9028-9bba274f049f}$windows.data.apps.devicemetadata",
"windowsDeviceId": "55f26da7-5824-4937-9028-9bba274f049f",
"settingType": "backup",
"payloadType": "windows.data.apps.devicemetadata",
"instances": [
{
"id": "da2f0307-2a8d-4242-846f-56abd95f7213",
"payload": "VGhpcyBpcyBqdXN0IGFuIGV4YW1wbGUh",
"lastModifiedDateTime": "2024-10-31T23:30:41Z",
"createdDateTime": "2024-02-12T19:34:35.223Z",
"expirationDateTime": "2034-02-09T19:34:33.771Z"
}
]
}
]
}
示例 4:使用筛选依据的请求 windowsDeviceId
请求
以下示例显示了一个请求。
GET https://graph.microsoft.com/beta/me/settings/windows?$filter=windowsDeviceId eq '67585f9f-ee4b-4dd8-808e-d88375d66ef7'
// Code snippets are only available for the latest version. Current version is 5.x
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Me.Settings.Windows.GetAsync((requestConfiguration) =>
{
requestConfiguration.QueryParameters.Filter = "windowsDeviceId eq '67585f9f-ee4b-4dd8-808e-d88375d66ef7'";
});
// THE CLI IS IN PREVIEW. NON-PRODUCTION USE ONLY
mgc-beta users settings windows list --user-id {user-id} --filter "windowsDeviceId eq '67585f9f-ee4b-4dd8-808e-d88375d66ef7'"
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphusers "github.com/microsoftgraph/msgraph-beta-sdk-go/users"
//other-imports
)
graphClient := msgraphsdk.NewGraphServiceClientWithCredentials(cred, scopes)
requestFilter := "windowsDeviceId eq '67585f9f-ee4b-4dd8-808e-d88375d66ef7'"
requestParameters := &graphusers.ItemSettingsWindowsRequestBuilderGetQueryParameters{
Filter: &requestFilter,
}
configuration := &graphusers.ItemSettingsWindowsRequestBuilderGetRequestConfiguration{
QueryParameters: requestParameters,
}
windows, err := graphClient.Me().Settings().Windows().Get(context.Background(), configuration)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
WindowsSettingCollectionResponse result = graphClient.me().settings().windows().get(requestConfiguration -> {
requestConfiguration.queryParameters.filter = "windowsDeviceId eq '67585f9f-ee4b-4dd8-808e-d88375d66ef7'";
});
const options = {
authProvider,
};
const client = Client.init(options);
let windows = await client.api('/me/settings/windows')
.version('beta')
.filter('windowsDeviceId eq \'67585f9f-ee4b-4dd8-808e-d88375d66ef7\'')
.get();
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Users\Item\Settings\Windows\WindowsRequestBuilderGetRequestConfiguration;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestConfiguration = new WindowsRequestBuilderGetRequestConfiguration();
$queryParameters = WindowsRequestBuilderGetRequestConfiguration::createQueryParameters();
$queryParameters->filter = "windowsDeviceId eq '67585f9f-ee4b-4dd8-808e-d88375d66ef7'";
$requestConfiguration->queryParameters = $queryParameters;
$result = $graphServiceClient->me()->settings()->windows()->get($requestConfiguration)->wait();
Import-Module Microsoft.Graph.Beta.Users
# A UPN can also be used as -UserId.
Get-MgBetaUserSettingWindows -UserId $userId -Filter "windowsDeviceId eq '67585f9f-ee4b-4dd8-808e-d88375d66ef7'"
from msgraph import GraphServiceClient
from msgraph.generated.users.item.settings.windows.windows_request_builder import WindowsRequestBuilder
graph_client = GraphServiceClient(credentials, scopes)
query_params = WindowsRequestBuilder.WindowsRequestBuilderGetQueryParameters(
filter = "windowsDeviceId eq '67585f9f-ee4b-4dd8-808e-d88375d66ef7'",
)
request_configuration = WindowsRequestBuilder.WindowsRequestBuilderGetRequestConfiguration(
query_parameters = query_params,
)
result = await graph_client.me.settings.windows.get(request_configuration = request_configuration)
响应
以下示例显示了相应的响应。
注意: 为了提高可读性,可能缩短了此处显示的响应对象。
HTTP/1.1 200 OK
Content-Type: application/json
{
"value": [
{
"@odata.type": "#microsoft.graph.windowsSetting",
"id": "{67585f9f-ee4b-4dd8-808e-d88375d66ef7}$windows.data.apps.devicemetadata",
"windowsDeviceId": "67585f9f-ee4b-4dd8-808e-d88375d66ef7",
"settingType": "backup",
"payloadType": "windows.data.apps.devicemetadata",
"instances": [
{
"id": "14b50191-10e5-4da5-9099-8c909b8458bd",
"payload": "VGhpcyBpcyBqdXN0IGFuIGV4YW1wbGUh",
"lastModifiedDateTime": "2024-10-31T23:30:41Z",
"createdDateTime": "2024-02-12T19:34:35.223Z",
"expirationDateTime": "2034-02-09T19:34:33.771Z"
}
]
}
]
}