我们正在遍历共享点API,以将所有共享点项目存储在数据库中。它还包括onenote笔记本/部分。上面没有页面详细信息,因此我们要调用onenote api来获取页面内容。 当我们从这两种方法中获取笔记本/节的详细信息时,除了用于关联数据的站点ID之外,它们在api响应中都没有什么共同之处。
两种方法是:
从下载网址下载节文件(点一个文件网址) (遍历整个层次结构或完整的路径)
直接从站点获取所有笔记本,部分,页面信息 (不遍历完整路径)
必填:我们需要使用第二种方法或任何其他方法的笔记本的完整路径信息 他们的ID相互关联。
Sharepoint Api请求:
https://graph.microsoft.com/ {version} / sites / {siteId} / drive / {driveId} / items / {itemsId} / children
样品申请
Api响应:(用于获取笔记本信息): 共享点ID:01UKI2O3RVAEYLDQTCWVAZXM5POTVX2P5R
"createdDateTime": "2018-07-13T13:58:54Z",
"eTag": "\"{B1300135-62C2-41B5-9BB3-AF74EB7D3FB1},1\"",
"id": "01UKI2O3RVAEYLDQTCWVAZXM5POTVX2P5R",
"lastModifiedDateTime": "2018-07-13T13:58:54Z",
"name": "Inked Content",
"webUrl": "https://alpsenseinc.sharepoint.com/sites/GoingToDeleteSite/_layouts/15/WopiFrame.aspx?sourcedoc=%7BB1300135-62C2-41B5-9BB3-AF74EB7D3FB1%7D&file=Inked%20Content&action=default",
"cTag": "\"c:{B1300135-62C2-41B5-9BB3-AF74EB7D3FB1},0\"",
"size": 40705,
"createdBy": {
"user": {
"email": "skumar@alpsenseinc.onmicrosoft.com",
"id": "5d53b261-edf1-46f2-89ce-aaa55204f050",
"displayName": "Satyam Kumar"
}
},
"lastModifiedBy": {
"user": {
"email": "skumar@alpsenseinc.onmicrosoft.com",
"id": "5d53b261-edf1-46f2-89ce-aaa55204f050",
"displayName": "Satyam Kumar"
}
},
"parentReference": {
"driveId": "b!5IphEVu8YkSUJcxbAa2UrLljKSxHnvBImd3JDcJmPyxiv448W7GwRKMggdKQRHiy",
"driveType": "documentLibrary",
"id": "01UKI2O3V6Y2GOVW7725BZO354PWSELRRZ",
"path": "/drives/b!5IphEVu8YkSUJcxbAa2UrLljKSxHnvBImd3JDcJmPyxiv448W7GwRKMggdKQRHiy/root:"
},
"fileSystemInfo": {
"createdDateTime": "2018-07-13T13:58:54Z",
"lastModifiedDateTime": "2018-07-13T13:58:54Z"
},
"package": {
"type": "oneNote"
}
}
`
获取笔记本的另一种方法:
https://graph.microsoft.com/ {version} / sites / {id} / onenote / {notebooks |栏目| sectionGroups |页面}
示例Api请求:
Api响应:
`Sharepoint Id : 1-b1300135-62c2-41b5-9bb3-af74eb7d3fb
{
"id": "1-b1300135-62c2-41b5-9bb3-af74eb7d3fb1",
"self": "https://graph.microsoft.com/v1.0/sites/alpsenseinc.sharepoint.com,11618ae4-bc5b-4462-9425-cc5b01ad94ac,2c2963b9-9e47-48f0-99dd-c90dc2663f2c/onenote/notebooks/1-b1300135-62c2-41b5-9bb3-af74eb7d3fb1",
"createdDateTime": "2018-07-13T13:58:54Z",
"displayName": "Inked Content",
"lastModifiedDateTime": "2018-07-13T13:58:54Z",
"isDefault": false,
"userRole": "Owner",
"isShared": false,
"sectionsUrl": "https://graph.microsoft.com/v1.0/sites/alpsenseinc.sharepoint.com,11618ae4-bc5b-4462-9425-cc5b01ad94ac,2c2963b9-9e47-48f0-99dd-c90dc2663f2c/onenote/notebooks/1-b1300135-62c2-41b5-9bb3-af74eb7d3fb1/sections",
"sectionGroupsUrl": "https://graph.microsoft.com/v1.0/sites/alpsenseinc.sharepoint.com,11618ae4-bc5b-4462-9425-cc5b01ad94ac,2c2963b9-9e47-48f0-99dd-c90dc2663f2c/onenote/notebooks/1-b1300135-62c2-41b5-9bb3-af74eb7d3fb1/sectionGroups",
"createdBy": {
"user": {
"id": "5d53b261-edf1-46f2-89ce-aaa55204f050",
"displayName": "Satyam Kumar"
}
},
"lastModifiedBy": {
"user": {
"id": "5d53b261-edf1-46f2-89ce-aaa55204f050",
"displayName": "Satyam Kumar"
}
},
"links": {
"oneNoteClientUrl": {
"href": "onenote:https://alpsenseinc.sharepoint.com/sites/GoingToDeleteSite/Shared%20Documents/Inked%20Content"
},
"oneNoteWebUrl": {
"href": "https://alpsenseinc.sharepoint.com/sites/GoingToDeleteSite/Shared%20Documents/Inked%20Content"
}
}
}`
两种方法的生成ID都不相同,它们之间没有建立关系以确定对象的层次结构或路径的连接。另外,我们不能完全依赖“ oneNoteClientUrl”作为实际路径。