更新 appLogCollectionRequest
本文内容
命名空间:microsoft.graph
注意: 适用于 Intune 的 Microsoft Graph API 需要适用于租户的活动 Intune 许可证 。
更新 appLogCollectionRequest 对象的属性。
此 API 可用于以下国家级云部署 。
全局服务
美国政府 L4
美国政府 L5 (DOD)
由世纪互联运营的中国
✅
✅
✅
✅
权限
要调用此 API,需要以下权限之一。 若要了解详细信息,包括如何选择权限的信息,请参阅权限 。
权限类型
权限(从最低特权到最高特权)
委派(工作或学校帐户)
DeviceManagementManagedDevices.ReadWrite.All
委派(个人 Microsoft 帐户)
不支持。
应用程序
DeviceManagementManagedDevices.ReadWrite.All
HTTP 请求
PATCH /deviceManagement/mobileAppTroubleshootingEvents/{mobileAppTroubleshootingEventId}/appLogCollectionRequests/{appLogCollectionRequestId}
标头
值
Authorization
持有者 {token}。 必填。 详细了解 身份验证和授权 。
接受
application/json
请求正文
在请求正文中,提供 appLogCollectionRequest 对象的 JSON 表示形式。
下表显示了创建 appLogCollectionRequest 时所需的属性。
属性
类型
说明
id
String
唯一标识符。 这是userId_DeviceId_AppId ID。
status
appLogUploadState
指示应用日志收集请求的状态(如果请求挂起、已完成或失败),默认值为挂起。 可取值为:pending
、completed
、failed
、unknownFutureValue
。
errorMessage
String
指示上传过程中出现错误消息(如果有)。
customLogFolders
字符串集合
日志文件夹列表。
completedDateTime
DateTimeOffset
上传日志请求达到已完成状态(如果尚未完成)的时间将返回 NULL。
响应
如果成功,此方法在响应正文中返回响应 200 OK
代码和更新的 appLogCollectionRequest 对象。
示例
请求
下面是一个请求示例。
PATCH https://graph.microsoft.com/v1.0/deviceManagement/mobileAppTroubleshootingEvents/{mobileAppTroubleshootingEventId}/appLogCollectionRequests/{appLogCollectionRequestId}
Content-type: application/json
Content-length: 257
{
"@odata.type": "#microsoft.graph.appLogCollectionRequest",
"status": "completed",
"errorMessage": "Error Message value",
"customLogFolders": [
"Custom Log Folders value"
],
"completedDateTime": "2016-12-31T23:58:52.3534526-08:00"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new AppLogCollectionRequest
{
OdataType = "#microsoft.graph.appLogCollectionRequest",
Status = AppLogUploadState.Completed,
ErrorMessage = "Error Message value",
CustomLogFolders = new List<string>
{
"Custom Log Folders value",
},
CompletedDateTime = DateTimeOffset.Parse("2016-12-31T23:58:52.3534526-08:00"),
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.DeviceManagement.MobileAppTroubleshootingEvents["{mobileAppTroubleshootingEvent-id}"].AppLogCollectionRequests["{appLogCollectionRequest-id}"].PatchAsync(requestBody);
有关如何将 SDK 添加 到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档 。
mgc device-management mobile-app-troubleshooting-events app-log-collection-requests patch --mobile-app-troubleshooting-event-id {mobileAppTroubleshootingEvent-id} --app-log-collection-request-id {appLogCollectionRequest-id} --body '{\
"@odata.type": "#microsoft.graph.appLogCollectionRequest",\
"status": "completed",\
"errorMessage": "Error Message value",\
"customLogFolders": [\
"Custom Log Folders value"\
],\
"completedDateTime": "2016-12-31T23:58:52.3534526-08:00"\
}\
'
有关如何将 SDK 添加 到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档 。
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
"time"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewAppLogCollectionRequest()
status := graphmodels.COMPLETED_APPLOGUPLOADSTATE
requestBody.SetStatus(&status)
errorMessage := "Error Message value"
requestBody.SetErrorMessage(&errorMessage)
customLogFolders := []string {
"Custom Log Folders value",
}
requestBody.SetCustomLogFolders(customLogFolders)
completedDateTime , err := time.Parse(time.RFC3339, "2016-12-31T23:58:52.3534526-08:00")
requestBody.SetCompletedDateTime(&completedDateTime)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
appLogCollectionRequests, err := graphClient.DeviceManagement().MobileAppTroubleshootingEvents().ByMobileAppTroubleshootingEventId("mobileAppTroubleshootingEvent-id").AppLogCollectionRequests().ByAppLogCollectionRequestId("appLogCollectionRequest-id").Patch(context.Background(), requestBody, nil)
有关如何将 SDK 添加 到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档 。
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
AppLogCollectionRequest appLogCollectionRequest = new AppLogCollectionRequest();
appLogCollectionRequest.setOdataType("#microsoft.graph.appLogCollectionRequest");
appLogCollectionRequest.setStatus(AppLogUploadState.Completed);
appLogCollectionRequest.setErrorMessage("Error Message value");
LinkedList<String> customLogFolders = new LinkedList<String>();
customLogFolders.add("Custom Log Folders value");
appLogCollectionRequest.setCustomLogFolders(customLogFolders);
OffsetDateTime completedDateTime = OffsetDateTime.parse("2016-12-31T23:58:52.3534526-08:00");
appLogCollectionRequest.setCompletedDateTime(completedDateTime);
AppLogCollectionRequest result = graphClient.deviceManagement().mobileAppTroubleshootingEvents().byMobileAppTroubleshootingEventId("{mobileAppTroubleshootingEvent-id}").appLogCollectionRequests().byAppLogCollectionRequestId("{appLogCollectionRequest-id}").patch(appLogCollectionRequest);
有关如何将 SDK 添加 到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档 。
const options = {
authProvider,
};
const client = Client.init(options);
const appLogCollectionRequest = {
'@odata.type': '#microsoft.graph.appLogCollectionRequest',
status: 'completed',
errorMessage: 'Error Message value',
customLogFolders: [
'Custom Log Folders value'
],
completedDateTime: '2016-12-31T23:58:52.3534526-08:00'
};
await client.api('/deviceManagement/mobileAppTroubleshootingEvents/{mobileAppTroubleshootingEventId}/appLogCollectionRequests/{appLogCollectionRequestId}')
.update(appLogCollectionRequest);
有关如何将 SDK 添加 到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档 。
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\AppLogCollectionRequest;
use Microsoft\Graph\Generated\Models\AppLogUploadState;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new AppLogCollectionRequest();
$requestBody->setOdataType('#microsoft.graph.appLogCollectionRequest');
$requestBody->setStatus(new AppLogUploadState('completed'));
$requestBody->setErrorMessage('Error Message value');
$requestBody->setCustomLogFolders(['Custom Log Folders value', ]);
$requestBody->setCompletedDateTime(new \DateTime('2016-12-31T23:58:52.3534526-08:00'));
$result = $graphServiceClient->deviceManagement()->mobileAppTroubleshootingEvents()->byMobileAppTroubleshootingEventId('mobileAppTroubleshootingEvent-id')->appLogCollectionRequests()->byAppLogCollectionRequestId('appLogCollectionRequest-id')->patch($requestBody)->wait();
有关如何将 SDK 添加 到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档 。
Import-Module Microsoft.Graph.DeviceManagement
$params = @{
"@odata.type" = "#microsoft.graph.appLogCollectionRequest"
status = "completed"
errorMessage = "Error Message value"
customLogFolders = @(
"Custom Log Folders value"
)
completedDateTime = [System.DateTime]::Parse("2016-12-31T23:58:52.3534526-08:00")
}
Update-MgDeviceManagementMobileAppTroubleshootingEventAppLogCollectionRequest -MobileAppTroubleshootingEventId $mobileAppTroubleshootingEventId -AppLogCollectionRequestId $appLogCollectionRequestId -BodyParameter $params
有关如何将 SDK 添加 到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档 。
from msgraph import GraphServiceClient
from msgraph.generated.models.app_log_collection_request import AppLogCollectionRequest
from msgraph.generated.models.app_log_upload_state import AppLogUploadState
graph_client = GraphServiceClient(credentials, scopes)
request_body = AppLogCollectionRequest(
odata_type = "#microsoft.graph.appLogCollectionRequest",
status = AppLogUploadState.Completed,
error_message = "Error Message value",
custom_log_folders = [
"Custom Log Folders value",
],
completed_date_time = "2016-12-31T23:58:52.3534526-08:00",
)
result = await graph_client.device_management.mobile_app_troubleshooting_events.by_mobile_app_troubleshooting_event_id('mobileAppTroubleshootingEvent-id').app_log_collection_requests.by_app_log_collection_request_id('appLogCollectionRequest-id').patch(request_body)
有关如何将 SDK 添加 到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档 。
响应
下面是一个响应示例。 注意:为简洁起见,可能会截断此处显示的响应对象。 将从实际调用中返回所有属性。
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 306
{
"@odata.type": "#microsoft.graph.appLogCollectionRequest",
"id": "cca685ff-85ff-cca6-ff85-a6ccff85a6cc",
"status": "completed",
"errorMessage": "Error Message value",
"customLogFolders": [
"Custom Log Folders value"
],
"completedDateTime": "2016-12-31T23:58:52.3534526-08:00"
}