适用于 Java 的 Sharepoint API

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/30299629/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 09:25:46  来源:igfitidea点击:

Sharepoint API for Java

javasharepoint

提问by Rahul Dev Mishra

Steps that I am trying to perform the following steps through Java:

我试图通过 Java 执行以下步骤的步骤:

1) Connect to a sharepoint site with a given URL.

1) 使用给定的 URL 连接到共享点站点。

2) Get the list of files listed on that page

2) 获取该页面上列出的文件列表

3) Filter the files using Modified date

3)使用修改日期过滤文件

4) Perform some more checks using Create Date and Modified Date

4)使用创建日期和修改日期执行更多检查

5) And finally save that file(s) into the Unix box.

5) 最后将该文件保存到 Unix 框中。

As of now, I am able to access a particular file and read through it. However I need to get hold of file's metadata before reading it. Is there an API or a way to do all these in Java.

到目前为止,我能够访问特定文件并通读它。但是,我需要在阅读之前掌握文件的元数据。是否有 API 或方法可以在 Java 中完成所有这些操作。

Thanks

谢谢

回答by 54l3d

You can use JShare from here : JShare API

您可以从这里使用 JShare:JShare API

It supports Microsoft SharePoint server 2013 and SharePoint Online / Office 365

它支持 Microsoft SharePoint server 2013 和 SharePoint Online / Office 365

回答by hbulens

With SharePoint 2013, the RESTservices will make your life easier. In previous versions, you could use the good old SOAPweb services.

借助 SharePoint 2013,REST服务将使您的生活更轻松。在以前的版本中,您可以使用很好的旧SOAPWeb 服务。

For instance, you could connect to a list with this query on the REST API:

例如,您可以使用 REST API 上的此查询连接到列表:

http://server/site/_api/lists/getbytitle('listname')/items

This will give you all items from that list. With OData you can do additional stuff like filtering:

这将为您提供该列表中的所有项目。使用 OData,您可以执行其他操作,例如过滤:

$filter=StartDate ge datetime'2015-05-21T00%3a00%3a00'

Additionally, you can provide CAML queries to these services, allowing you to define detailed queries. Here's an example in Javascript:

此外,您可以向这些服务提供 CAML 查询,从而允许您定义详细的查询。这是 Javascript 中的一个示例:

var re = new SP.RequestExecutor(webUrl);
re.executeAsync({
url: "http://server/site/_api/web/lists/getbytitle('listname')/GetItems",
method: 'POST',
headers: { 
    "Accept": "application/json; odata=verbose",
    "Content-Type": "application/json; odata=verbose"
  },
body: { 
    "query" : {
      "__metadata": {
        "type": "SP.CamlQuery" 
      },
      "ViewXml": "<View>" +
        "<Query>" + query + "</Query>" +                       
      "</View>"
    }
  },
success: successHandler,
error: errorHandler
});

If all of this doesn't provide enough flexibility, you might as well take these list items in memory and do additional work in your (server side) code.

如果所有这些都不能提供足够的灵活性,您不妨将这些列表项放在内存中,并在您的(服务器端)代码中做额外的工作。