Namespace: microsoft.graph
Note: The Microsoft Graph API for Intune requires an active Intune license for the tenant.
Create a new appLogCollectionRequest object.
This API is available in the following national cloud deployments.
Global service |
US Government L4 |
US Government L5 (DOD) |
China operated by 21Vianet |
✅ |
✅ |
✅ |
✅ |
Permissions
One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.
Permission type |
Permissions (from least to most privileged) |
Delegated (work or school account) |
DeviceManagementManagedDevices.ReadWrite.All |
Delegated (personal Microsoft account) |
Not supported. |
Application |
DeviceManagementManagedDevices.ReadWrite.All |
HTTP Request
POST /deviceManagement/mobileAppTroubleshootingEvents/{mobileAppTroubleshootingEventId}/appLogCollectionRequests
Request body
In the request body, supply a JSON representation for the appLogCollectionRequest object.
The following table shows the properties that are required when you create the appLogCollectionRequest.
Property |
Type |
Description |
id |
String |
The unique Identifier. This is userId_DeviceId_AppId id. |
status |
appLogUploadState |
Indicates the status for the app log collection request if it is pending, completed or failed, Default is pending. Possible values are: pending , completed , failed , unknownFutureValue . |
errorMessage |
String |
Indicates error message if any during the upload process. |
customLogFolders |
String collection |
List of log folders. |
completedDateTime |
DateTimeOffset |
Time at which the upload log request reached a completed state if not completed yet NULL will be returned. |
Response
If successful, this method returns a 201 Created
response code and a appLogCollectionRequest object in the response body.
Example
Request
Here is an example of the request.
POST https://graph.microsoft.com/v1.0/deviceManagement/mobileAppTroubleshootingEvents/{mobileAppTroubleshootingEventId}/appLogCollectionRequests
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.PostAsync(requestBody);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
mgc device-management mobile-app-troubleshooting-events app-log-collection-requests create --mobile-app-troubleshooting-event-id {mobileAppTroubleshootingEvent-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"\
}\
'
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
// 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().Post(context.Background(), requestBody, nil)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
// 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().post(appLogCollectionRequest);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
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')
.post(appLogCollectionRequest);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
<?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()->post($requestBody)->wait();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
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")
}
New-MgDeviceManagementMobileAppTroubleshootingEventAppLogCollectionRequest -MobileAppTroubleshootingEventId $mobileAppTroubleshootingEventId -BodyParameter $params
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.app_log_collection_request import AppLogCollectionRequest
from msgraph.generated.models.app_log_upload_state import AppLogUploadState
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
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.post(request_body)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
Response
Here is an example of the response. Note: The response object shown here may be truncated for brevity. All of the properties will be returned from an actual call.
HTTP/1.1 201 Created
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"
}