python-2.7 - 使用python获取共享点目录中的文件列表

标签 python-2.7 rest sharepoint-2013

我有一个共享点目录(内联网)的 url,需要一个 api 来返回给定 url 的目录中的文件列表。我怎么能用python做到这一点?

最佳答案

你需要在这里做两件事。

  • 获取文件列表(可以是目录或简单文件)
    您感兴趣的目录。
  • 遍历此文件列表中的每个项目并检查是否
    该项目是一个文件或一个目录。对于每个目录执行相同的操作
    步骤 1 和 2。

  • 您可以在 https://docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-folders-and-files-with-rest#working-with-files-attached-to-list-items-by-using-rest 找到更多文档。
    def getFilesList(directoryName):
        ...
        return filesList
    
    # This will tell you if the item is a file or a directory.
    def isDirectory(item):
        ...
        return true/false
    

    希望这可以帮助。

    关于python-2.7 - 使用python获取共享点目录中的文件列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50531425/

    相关文章:

    python - 为什么我的埃拉托色尼筛法处理整数比处理 boolean 值更快?

    rest - 经典ASP亚马逊s3休息授权

    c# - C# 中的 Twitter 服务代理

    sharepoint-2013 - 如何修改 sharepoint 2013 列表列标题?

    javascript - 更改共享点中特定文本的颜色文本

    SharePoint 错误 : The server does not allow messages larger than 2097152 bytes

    python - 打开从 os.listdir() 找到的文件并对文件执行任务

    python - 如何过滤日期时间字段上的对象?

    Python urllib 在浏览器工作时被拒绝访问

    rest - Bing map REST API 无法正常工作