microsoftgraph / microsoftgraph/msgraph-sdk-java

can't access oneDrive recycle bin

Offen
#2,327 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

status:waiting-for-triage type:bug
Vorherrschende Sprache
Java
Sterne
444
Forks
154
Ø Merge
18 Std. 28 Min.
Gemergte PRs (30 T.)
4

Beschreibung

Describe the bug

from an app with Application permissions.

I try to get the recycle bin content of a user with using the call listed here
https://learn.microsoft.com/en-us/graph/api/filestoragecontainer-list-recyclebinitem?view=graph-rest-1.0

that is to say
GET /storage/fileStorage/containers/{containerId}/recycleBin/items

In containerId, I put the driveId of the user.

with the last java sdk, it looks like this
graphClient.storage().fileStorage().containers().byFileStorageContainerId(fileStorageContainerId).recycleBin().items().get();

But I get this error
com.microsoft.graph.models.odataerrors.ODataError: One of the provided arguments is not acceptable.

but using the same driveId, this call do work as intended
graphClient.storage().fileStorage().containers().byFileStorageContainerId(fileStorageContainerId).drive()

I do have the permission FileStorageContainer.Selected enabled for the application

I already tried to ask in another place to see if there is a problem with the way I use the call but didn't have any relevant anwers.
https://learn.microsoft.com/en-us/answers/questions/2180582/getting-the-contents-of-the-recycle-bin-from-msgra

Expected behavior

this call
graphClient.storage().fileStorage().containers().byFileStorageContainerId(fileStorageContainerId).recycleBin().items().get();

should give me a list of drive items

How to reproduce

with app permission, call this and put in fileStorageContainerId a user's drive id.

graphClient.storage().fileStorage().containers().byFileStorageContainerId(fileStorageContainerId).recycleBin().items().get();

If the problem is reproduced, you will get an error

here is a complete code

import com.azure.identity.ClientSecretCredential;
import com.azure.identity.ClientSecretCredentialBuilder;
import com.microsoft.graph.models.RecycleBinItemCollectionResponse;
import com.microsoft.graph.serviceclient.GraphServiceClient;
import jakarta.annotation.PostConstruct;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class RpiApigraphTestApplication {

    public static void main(String[] args) {
        SpringApplication.run(RpiApigraphTestApplication.class, args);
    }

    @PostConstruct
    public void myMain() {
        final String clientId = "";
        final String tenantId = "";
        final String clientSecret = "";

        final String[] scopes = new String[]{"https://graph.microsoft.com/.default"};

        final ClientSecretCredential credential = new ClientSecretCredentialBuilder()
                .clientId(clientId).tenantId(tenantId).clientSecret(clientSecret).build();

        if (null == scopes || null == credential) {
            System.out.println("error");
        }

        final GraphServiceClient graphClient = new GraphServiceClient(credential, scopes);

        String fileStorageContainerId = ""; //put the driveId Of a user Here


		//works as intended
        graphClient.
                storage().fileStorage().containers().byFileStorageContainerId(fileStorageContainerId).drive();


		//will return an error
        RecycleBinItemCollectionResponse result =
                graphClient.
                storage().fileStorage().containers().byFileStorageContainerId(fileStorageContainerId).recycleBin().items().get();

		
        System.out.println("");
    }

}
SDK Version

6.29.0

Latest version known to work for scenario above?

No response

Known Workarounds

No response

Debug output

error 400

Method threw 'com.microsoft.graph.models.odataerrors.ODataError' exception.
com.microsoft.graph.models.odataerrors.ODataError: One of the provided arguments is not acceptable.

Configuration

No response

Other information

No response

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginnen Sie mit dem dokumentierten recycle-bin-Endpunkt und dem GraphServiceClient-Aufruf im vollständigen Java-Beispiel, und reproduzieren Sie anschließend die 400-Antwort unter Verwendung der angegebenen Anwendungsberechtigung und der SDK-Version 6.29.0. Vergleichen Sie die Anfrage für den Einstiegspunkt der recycle-bin-Elemente mit der funktionierenden Drive-Anfrage; abgeschlossen ist die Aufgabe, wenn festgestellt wurde, ob der Fehler in der SDK-Anfrage oder im Verhalten des Dienstes/der API liegt, und die Belege dokumentiert wurden.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
java
Bereich
api
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.