SharePoint命令行界面

sharepointcli的Python项目详细描述


安装

$ pip install sharepointcli

配置

对于一般用途,spo configure命令是设置sharepointcli的最快方法。 输入此命令时,CLI将提示您输入以下配置:

  • SharePoint域
  • 用户名
  • 密码

spo configure命令将凭据存储在凭据文件中。 您可以为不同的SharePoint域配置多个凭据。 示例:

^{pr2}$

凭据的优先级顺序如下:

  1. 命令行选项
  2. 环境变量
  3. 凭据文件

命令行选项

可以使用以下命令行选项覆盖默认配置设置。在

  • --用户名<;string>;

    指定用户名。在

  • --密码<;string>;

    指定与用户名关联的密码。在

  • --超时<;string>;

    以秒为单位指定超时。在

环境变量

环境变量提供了另一种指定凭据的方法,并且可以 对编写脚本很有用。 如果通过在命令行上使用参数指定选项,则 重写环境变量或配置文件中的任何值。在

CLI支持以下环境变量:

  • SPO\u凭据文件

    指定CLI存储凭据的文件的位置。 默认路径是~/.spo/credentials。在

  • SPO\u用户名

    指定用户名。在

  • SPO_密码

    指定与用户名关联的密码。在

  • SPO\u超时

    以秒为单位指定超时。在

凭证文件

CLI将敏感的凭据信息存储在主目录中名为.spo的目录中名为credentials的文件中。 例如,使用spo configure生成的文件类似于以下内容:

[example.sharepoint.com]username=user@example.compassword=secret

使用

配置

配置凭据。在

用法

$ spo configure [domain]

cp

正在将本地文件复制到SharePoint。在

用法

$ spo cp <LocalPath> <SharePointUrl>   or   cp <SharePointUrl> <LocalPath>

示例

以下cp命令将单个文件复制到指定站点:

$ spo cp test.txt 'https://example.sharepoint.com/sites/example/Shared documents/test.txt'upload: test.txt to https://example.sharepoint.com/sites/example/Shared documents/test.txt

从以下命令复制单个SharePoint文件:

$ spo cp 'https://example.sharepoint.com/sites/example/Shared documents/test.txt' test.txt
download: https://example.sharepoint.com/sites/example/Shared documents/test.txt' to test.txt

帮助

显示命令帮助。在

用法

$ spo help[topic]

ls

列出文件和文件夹。在

用法

$ spo ls [options] <SharePointUrl>
选项

-mtime n文件的状态上次更改是在24小时前。('+n'大于n,'n'正好是n,'-n'小于n)

示例

$ spo ls 'https://example.sharepoint.com/sites/example/Shared documents/*.txt'

mkdir

创建文件夹。在

用法

$ spo mkdir <SharePointUrl>

rm

删除文件。在

用法

$ spo rm [options] <SharePointUrl>
选项

-mtime n文件的状态上次更改是在24小时前。('+n'大于n,'n'正好是n,'-n'小于n)

示例

$ spo rm 'https://example.sharepoint.com/sites/example/Shared documents/*.txt'

rmdir

删除文件夹。在

用法

$ spo rmdir <SharePointUrl>

版本

打印版本号。在

用法

$ spo version

测试

要运行单元测试:

  • 创建~/.spo/credentials凭据文件
  • 将SharePoint测试站点url导出为环境变量“site”
$ spo configure
SharePoint domain (e.g. example.sharepoint.com): example.sharepoint.comUsername: test@example.comPassword: *****$ expot SITE='https://example.sharepoint.com/sites/example/Shared documents/test folder'$ make test

许可证

这个项目是由麻省理工学院授权的。在

链接

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
Maven中的java,为什么要运行“mvn clean”?   java会降低图像质量。OutOfMemory异常Android   在Java8中将函数传递到流的过滤方法   jboss6。x java。lang.NoClassDefFoundError,当我将<listenerclass>包含到web时。xml java   java读取图像像素时,像素Alpha始终为255   java在迭代后跳过一行   java如何创建我自己的单链表   意图上的java空指针异常。getStringExtra.:安卓   具有连接实体的java Hibernate onetoone映射   java需要帮助在自制的仓鼠模拟器上实现启动/恢复/暂停/停止线程操作   如何测试非主方法?[Java,IntelliJ]   java jdbc自动提交(false)不起作用   java在JADE中的同一容器中创建多个代理   java OkHttp获取失败的响应正文   java Webdriver flash按钮