上一篇博文中已经介绍了Java调用SharePoint WebService获取文件
https://cloud.tencent.com/developer/article/1994187
默认的数据查询范围是Default,即显示列表当前目录下的所有文件以及文件夹,并不包括文件夹里的文件。
这里主要介绍如何获取SharePoint的文件夹
Default: Show only the files and subfolders of a specific folder.
Recursive: Show all files of all folders.
RecursiveAll: Show all files and all subfolders of all folders.
FilesOnly: Show only the files of a specific folder
只要修改XML文件查询选项即可。
代码语言:javascript复制<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<GetListItems xmlns="http://schemas.microsoft.com/sharepoint/soap/">
<listName>XXX通知</listName>
<query>
<Query></Query>
</query>
<viewFields>
<ViewFields xmlns="" />
</viewFields>
<rowLimit>300</rowLimit>
<queryOptions>
<QueryOptions xmlns="">
<ViewAttributes Scope="Recursive" />
</QueryOptions>
</queryOptions>
</GetListItems>
</soap:Body>
</soap:Envelope>
其余代码不变。