microsoftgraph / microsoftgraph/msgraph-sdk-java
can't access oneDrive recycle bin
还没有人认领这个 Issue。
- 主要语言
- Java
- 星标
- 444
- 派生
- 154
- 平均合并
- 18 小时 28 分钟
- 30 天内合并 PR
- 4
描述
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
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
先从完整 Java 示例中已记录的 recycle-bin 端点和 GraphServiceClient 调用开始,然后使用所述的应用程序权限和 SDK 版本 6.29.0 重现 400 响应。将 recycle-bin 项入口的请求与正常工作的 Drive 请求进行比较;完成的标准是确定失败发生在 SDK 请求中还是服务/API 行为中,并记录证据。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- java
- 领域
- api
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100