I am working with Python and I am using the shareplum library to fetch info about my files.
So after using my login info, including username, password, domain and site, I have a site object.
From this site object you can call
sp.GetListCollection()
which provides you with a listing of what is called “lists” in this specific case they correspond to that:
SharePointView of the site’s lists
In my Notebook it looks like this:
JupyterView
Once you have the site object you can call a list object, in my case it is ‘Documents’
documents = sp.List(list_name='Documents')
And from that point you can call
documents.get_list_items()
Which gives you info about what is contained in the Documents list,
SharePoint view
Jupyter view
As displayed on the picture, the columns contain data which I want to retrieve. The columns in red are examples.
At this point we are dealing with a SharePoint List object and to reach the files and folders contained here we can use:
folder = sp.Folder("Shared Documents/Test_Library")
Which means we are now handling a _Folder object
This folder is this one one the SharePoint side:
Inside the folder
On the Folder object you can retrieve the infos about waht is inside:
contents = folder.files + folder.folders
Which returns a list of dictionnaries, one per file, plus the names of the subfolders:
jupyter view
And for each file we get infos:
-‘odata.type’,
- ‘odata.id’,
- ‘odata.editLink’,
- ‘CheckInComment’,
- ‘CheckOutType’,
[…] - ‘Name’,
- ‘ServerRelativeUrl’,
- ‘TimeCreated’,
- ‘TimeLastModified’,
- ‘Title’,
- ‘UIVersion’,
- ‘UIVersionLabel’,
- ‘UniqueId’
But the info from the columns in the SharePoint are not retrieved, like my example columns “monkey” and “woohoo” that are not part of the dictionnary keys
In a nutshell, what I would like to do is to get the same outout as if I were using .get_list_items(), but at the ._Folder object level.
Has anyone already dealt with this issue ?
I have tried to check the source code of the library shareplum, as well as the online documentation
I have tried to use other libraries but I feel like with shareplum I am the closest to my solution.
The objective at the end would to have a SharePoint Crawler able to retrieve all available metadata about any file/folder, as well as the files/folders locations
Pablo_le_Vicieux is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.