Retrieving IDs Using Content Service
All Endpoints for SharePoint will use the universally unique identifier (guid) for id parameters. There are a few ways to retrieve ids for items in a libraries.
-
Use the idbypath endpoint in content services - Probably the quickest solution. The endpoint takes fileName and folderPath. You do not need to include the root folder path for the library. If the document is in the root folder of the library (Shared Documents in Documents, for example), then pass the value "/".
Example: If we are trying to retrieve Shared Documents/test/folder/mydoc.txt in the Documents library, the call would look like this:
http://localhost:8081/3sixty-admin/api/repo/spo/idbypath?folderPath=test/folder&fileName=mydoc.txt
And should retrieve the following response:
{
"success": true,
"results": "ad7c1901-eb58-42f9-a9eb-38210896adcd"
}
-
Use the rootfolderid and folder items endpoint.
The rootfolderid endpoint should produce the following for a connections with site "sites/Dev" and no list name configured
http://localhost:8081/3sixty-admin/api/repo/spo/rootfolderid
{
"success": true,
"results": {
"folderPath": "/sites/Dev/Shared Documents",
"folderId": "8c06f41e-3c5b-4252-a8b1-1bb14d1989ec",
"folderName": "Shared Documents"
}
}
With that id, we can then iterate over the items in that folder using the folderitems endpoint
http://localhost:8081/3sixty-admin/api/repo/spo/folderitems?id=8c06f41e-3c5b-4252-a8b1-1bb14d1989ec
{
"success": true,
"results": {
"025f91b6-b923-44b4-aa54-8ded345cee9f": {
"ETag": "025F91B6-B923-44B4-AA54-8DED345CEE9F",
"createdDate": "2020-12-01T18:08:35Z",
"description": "",
"itemPath": "/sites/Dev/Shared Documents/Dell_BWA_Political_capital.xlsx",
"length": "124089",
"modifiedDate": "2020-12-01T18:08:35Z",
"type": "Document",
"versionCount": "2"
},
"159f65fa-0351-4fb3-bfe9-cff99831488a": {
"ETag": "159F65FA-0351-4FB3-BFE9-CFF99831488A",
"createdDate": "2020-12-01T18:08:46Z",
"description": "",
"itemPath": "/sites/Dev/Shared Documents/Liberty_Mutual_Insurance_Group_SWE_Mobile.pdf",
"length": "22919",
"modifiedDate": "2020-12-01T18:08:46Z",
"type": "Document",
"versionCount": "2"
},
"ae2df7c9-8a70-491b-8beb-bd8fb5e0004e": {
"ETag": "AE2DF7C9-8A70-491B-8BEB-BD8FB5E0004E",
"createdDate": "2020-12-01T18:08:56Z",
"description": "",
"itemPath": "/sites/Dev/Shared Documents/UnitedHealth_Group_MNG_Client-centric.pdf",
"length": "370839",
"modifiedDate": "2020-12-01T18:08:56Z",
"type": "Document",
"versionCount": "2"
},
"d352ecef-ead2-4e5f-b105-4aa70d48bf5d": {
"createdDate": "2021-09-02T18:22:59Z",
"itemCount": "1",
"itemPath": "/sites/Dev/Shared Documents/MyTest",
"modifiedDate": "2021-09-03T17:26:25Z",
"type": "Folder"
}
}
}
From here you can further iterate through the children of the MyTest folder or grab the document id for later use.
Related Articles