MS图形API共享点站点.在根目录下创建一个文件夹 [英] MS graph API sharepoint site. Create a folder in root

查看:79
本文介绍了MS图形API共享点站点.在根目录下创建一个文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用MS graph API与共享点网站一起使用. 一切正常,除非我找不到如何在网站根目录中创建文件夹(文件夹是文档库).

I try to use the MS graph API to work with sharepoint sites. All works fine, except i can not find how to create a folder in root of a site (folders are documents library).

如果我知道站点ID(SITEID),则可以将站点根目录中的文件夹列出为驱动器

If i know the site id (SITEID) i can list folders in root of the site as drives

GET /v1.0/sites/SITEID/drives

我为每个项目都有ID(就像驱动器ID).我可以列出驱动器上的文件夹(这些文件夹是网站上顶级文件夹的子文件夹)

I have ID for each item (it is like a drive ID). The i can list folders on drives (which are subfolders of top level folders on a site)

GET /v1.0/sites/SITEID/drives/DRIVEID/root/children

我可以在此位置创建文件夹和子文件夹

I can create folders in this place and subfolders

POST /v1.0/sites/SITEID/drives/DRIVEID/root/children
{
  "name": "New Folder 2",
  "folder": {}
}

但是如何在网站上创建顶级文件夹?实际上,如何在网站上创建新驱动器?

But how to create a top level folder on a site? In fact, how to create new drive on a site?

我试图猜测类似的东西

POST /v1.0/sites/SITEID/drives
{
  "name": "New Drive",
  "folder": {}
}

但这不起作用

此外,我尝试创建一个列表 https://developer.microsoft.com/zh-CN/graph/docs/api-reference/beta/api/list_create

Also, i tried to create a list https://developer.microsoft.com/en-us/graph/docs/api-reference/beta/api/list_create

POST /v1.0/sites/SITEID/lists
{
  "name": "Books",
  "columns": [
    {
      "name": "Author",
      "text": { }
    },
    {
      "name": "PageCount",
      "number": { }
    }
  ],
  "list": {
    "template": "documentLibrary"
  }
}

没有成功

推荐答案

我认为您错了.文件夹不是文档库.

I think you are wrong. Folders are not document libraries.

驱动器是一个文档库.文档库是带有 template:document library 的列表,因此drive也是一个列表.

Drive is a document library. Document library is a list with template: document library, so drive is also a list.

端点

GET /v1.0/sites/SITEID/drives

将返回带有 template:文档库的列表列表.

will return a list of lists with template: document library.

端点

GET /v1.0/sites/SITEID/lists

将返回所有类型的所有列表.

will return all lists of all types.

要创建新的驱动器(文档库),您应该使用文档库作为 template 创建一个新列表.然后,您将在网站根目录中拥有一个新驱动器.

To create new drive (a document library) you should create a new list with document library as template. Then you will have a new drive in a root of the site.

创建新列表有什么问题?

What problem do you have with creation of a new list?

这篇关于MS图形API共享点站点.在根目录下创建一个文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆