microsoftgraph / microsoftgraph/msgraph-beta-sdk-java

Cannot delete audit log query using

Open
#1,162 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

type:bug
Dominant language
Java
Stars
32
Forks
14
Avg merge
1d 3h
Merged PRs (30d)
6

Description

Describe the bug

Using the com.microsoft.graph.beta.serviceclient.GraphServiceClient as betaGraphClient
I can successfully create audit log queries using betaGraphClient.security().auditLog().queries().post(auditLogQuery) but cannot delete the queries using betaGraphClient.security().auditLog().queries().byAuditLogQueryId(queryId).delete()
The call fails with

com.microsoft.graph.beta.models.odataerrors.ODataError: {"message":"No HTTP resource was found that matches the request URI 'https://o365adtsearchapi-na002-es.westus.cloudapp.azure.com/security/auditLog/queries('9032b6a1-04bb-440e-973f-637ddc63bac8')'.","messageDetail":"No type was found that matches the controller named 'queries'."}
        at com.microsoft.graph.beta.models.odataerrors.ODataError.createFromDiscriminatorValue(ODataError.java:36)
        at com.microsoft.kiota.serialization.JsonParseNode.getObjectValue(JsonParseNode.java:212)
        at com.microsoft.kiota.http.OkHttpRequestAdapter.lambda$throwIfFailedResponse$0(OkHttpRequestAdapter.java:673)
        at com.microsoft.kiota.ApiExceptionBuilder.<init>(ApiExceptionBuilder.java:26)
        at com.microsoft.kiota.http.OkHttpRequestAdapter.throwIfFailedResponse(OkHttpRequestAdapter.java:672)
        at com.microsoft.kiota.http.OkHttpRequestAdapter.sendPrimitive(OkHttpRequestAdapter.java:342)
        at com.microsoft.graph.beta.security.auditlog.queries.item.AuditLogQueryItemRequestBuilder.delete(AuditLogQueryItemRequestBuilder.java:64)
        at com.microsoft.graph.beta.security.auditlog.queries.item.AuditLogQueryItemRequestBuilder.delete(AuditLogQueryItemRequestBuilder.java:53)
Expected behavior

Able to delete an audit log query

How to reproduce
        // Build a ClientSecretCredential for authentication
        ClientSecretCredential clientSecretCredential = new ClientSecretCredentialBuilder()
                .clientId(clientId)
                .tenantId(tenantId)
                .clientSecret(clientSecret)
                .build();
        com.microsoft.graph.beta.serviceclient.GraphServiceClient betaGraphClient = new com.microsoft.graph.beta.serviceclient.GraphServiceClient(
                clientSecretCredential, scopes);
        com.microsoft.graph.beta.models.security.AuditLogQuery auditLogQuery = new com.microsoft.graph.beta.models.security.AuditLogQuery();
        auditLogQuery.setOdataType("#microsoft.graph.security.auditLogQuery");
        auditLogQuery.setDisplayName("Test query");
        auditLogQuery.setFilterStartDateTime("2025-04-20T00:00:00Z");
        auditLogQuery.setFilterEndDateTime("2025-04-20T01:00:00Z");
        // submit the query
        AuditLogQuery auditLogQuerySubmitted = betaGraphClient.security().auditLog().queries().post(auditLogQuery);
        String queryId = auditLogQuerySubmitted.getId();
        // wait for completion
        // delete the query
        betaGraphClient.security().auditLog().queries().byAuditLogQueryId(queryId).delete();
SDK Version

6.36.0

Latest version known to work for scenario above?

No response

Known Workarounds

none

Debug output
Click to expand log ```
</details>


### Configuration

_No response_

### Other information

_No response_

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the generated delete path in AuditLogQueryItemRequestBuilder.java, referenced in the stack trace, and compare it with the request path used when creating the audit log query. Verify whether the generated request matches the service endpoint for deletion using the reproduction against SDK 6.36.0; done means deleting a created query succeeds without the OData resource error.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.