Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/sharepoint/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 使用MS GraphAPI将(小)文件上载到sharepoint文件夹。文件过时_Java_Sharepoint_Microsoft Graph Api - Fatal编程技术网

Java 使用MS GraphAPI将(小)文件上载到sharepoint文件夹。文件过时

Java 使用MS GraphAPI将(小)文件上载到sharepoint文件夹。文件过时,java,sharepoint,microsoft-graph-api,Java,Sharepoint,Microsoft Graph Api,我想将小文件上载到sharepoint文件夹。我在里面找到了样品。 不幸的是,提供的示例语法不正确-无法编译!文档可能没有更新以反映最新(v3)的更改 方法put()不再接受stream。它只接受DriveItem,但我找不到用stream初始化它的方法 @Nullable public DriveItem put(@Nonnull final DriveItem newDriveItem) throws ClientException { return (DriveItem)this.

我想将小文件上载到sharepoint文件夹。我在里面找到了样品。 不幸的是,提供的示例语法不正确-无法编译!文档可能没有更新以反映最新(v3)的更改

方法
put()
不再接受
stream
。它只接受
DriveItem
,但我找不到用stream初始化它的方法

@Nullable
public DriveItem put(@Nonnull final DriveItem newDriveItem) throws ClientException {
    return (DriveItem)this.send(HttpMethod.PUT, newDriveItem);
}

有人能提供工作示例吗?和/或列出当前(功能)文档。。。谢谢。

我认为正确的方法是在
.items()之后添加
.content()

@Nullable
public DriveItem put(@Nonnull final DriveItem newDriveItem) throws ClientException {
    return (DriveItem)this.send(HttpMethod.PUT, newDriveItem);
}
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();

byte[] stream = Base64.getDecoder().decode("The contents of the file goes here.");
    graphClient.me().drive().items("{item-id}")
    .content()
    .buildRequest()
    .put(_stream_);