# netlink-sharepoint-base
## Basic Tools for interaction with Sharepoint Sites
This has been moved from `netlink-sharepoint`
For now only **Lists** are considered.
## `sharepoint_list_info`
Script to help mapping
```shell
Usage: sharepoint_list_info.py [OPTIONS] [NAME]...
Print information about SharePoint List(s)
NAME is not provided, all lists are returned.
Options:
-u, --url TEXT Sharepoint URL
-i, --client-id TEXT Client ID
-s, --client-secret TEXT Client Secret
-t, --toml FILE TOML file with 'url', 'client_id', and 'client_secret'
-f, --fields include fields
--hidden include hidden lists (and fields)
```
## `netlink.sharepoint.base.Site`
Main class representing a Sharepoint site. Can either be used directly providing the parameters
- url
- client_id
- client_secret
or inherited from
```python
from netlink.sharepoint.base import Site as _Site
class Site(_Site):
_url = "https://somewhere.sharepoint.com/sites/something"
_client_id = "00000000-0000-0000-0000-000000000000"
_client_secret = "abcdefghijklmnopqrstuvwxyz01234567890+/abcd="
```
### url
_read-only_
### users
_read-only (always a copy of the actual data)_
Dict of the users of the site.
| Column | Type | Description |
|--------|:-----:|-----|
| id | int | reference key for AuthorID, EditorID, etc. |
| family_name | str | a.k.a. last name |
| given_name | str | a.k.a. first name |
| name | str | {family_name}, {given_name} |
| email | str | |
**Note** This is based on a default Sharepoint setup. This might not work for you.
### get_list(name)
Returns a Sharepoint List object (`office365.sharepoint.lists.list.List`) by **name**.
### get_lists(hidden=False)
Returns a list of Sharepoint List objects (`office365.sharepoint.lists.list.List`). If `hidden` is `True`, internal
Lists are included.
### get_list_items(name)
Returns list of all items (`office365.sharepoint.listitems.listitem.ListItem`) from **name**d Sharepoint List.
### get_list_columns(name, hidden=False)
Returns list of columns (a.k.a. Fields) of the **name**d Sharepoint List. If `hidden` is `True`, internal columns are
included.
### commit()
Send all pending updates to Sharepoint.
## `netlink.sharepoint.base.List`
Class representing a Sharepoint List. This is a `collections.abc.Mapping`. Contents are mapped with the unique `id` of
the item in the Sharepoint List.
When inherited from, class attribute
- `_title` must be set.
- `_map` should be set, but can be overridden. This maps the python name (best to use a valid attribute-name)
to the respective internal Sharepoint name. Do not map 'id' or 'ID', this is done automatically as the primary key.
- `_upper_case` can be set to be used in `normalize` to enforce that the respective columns are set to uppercase.
- `_required` can be set to ensure that the respective columns are not empty (as defined by Python: `None`, empty
string, or numeric zero).
At this point very optimistic (as in none-at-all) locking is used.
The item itself keeps information if data has been changed.
### load()
Loads all items from the Sharepoint List.
### rollback()
Clears all local entries and calls `load`. At this time there is no difference, but when adding items will be supported,
this would clear them.
### get(item, buffered=True)
Loads (if nor already loaded) item based on unique `id`. If `buffered` is `False`, read from Sharepoint is forced.
### commit()
Commit all changed items to Sharepoint.
### normalize()
Processes `_upper_case` for all items.
Consider overriding this to set columns based on other columns.
### validate()
Processes `_required` for all items.
Consider overriding this to check list-wide constraints, like composite unique keys.
## Item
This is a special class that gets build dynamically for each List. It is a `collections.abc.MutableMapping`.
It handles keeping state of changes and processes the actual mapping between Python and Sharepoint columns (fields).
### commit(lazy=False)
Update the internal `office365.sharepoint.listitems.listitem.ListItem` with any pending changes. If `lazy` is `True`,
changes are not sent to Sharepoint, providing the option to send on List or Site level.
## License
MIT
Raw data
{
"_id": null,
"home_page": "https://gitlab.com/netlink_python/netlink-sharepoint-base",
"name": "netlink-sharepoint-base",
"maintainer": null,
"docs_url": null,
"requires_python": "<=3.12,>=3.8",
"maintainer_email": null,
"keywords": "sharepoint",
"author": "Bernhard Radermacher",
"author_email": "bernhard.radermacher@netlink-consulting.com",
"download_url": "https://files.pythonhosted.org/packages/66/4b/dcafa0fe65e701570c585facb9c97f9bd190c847374a7e5c423f2ce2ac93/netlink-sharepoint-base-0.0.8.tar.gz",
"platform": null,
"description": "# netlink-sharepoint-base\n\n## Basic Tools for interaction with Sharepoint Sites\n\nThis has been moved from `netlink-sharepoint`\n\nFor now only **Lists** are considered.\n\n## `sharepoint_list_info`\n\nScript to help mapping\n\n```shell\nUsage: sharepoint_list_info.py [OPTIONS] [NAME]...\n\n Print information about SharePoint List(s)\n\n NAME is not provided, all lists are returned.\n\nOptions:\n -u, --url TEXT Sharepoint URL\n -i, --client-id TEXT Client ID\n -s, --client-secret TEXT Client Secret\n -t, --toml FILE TOML file with 'url', 'client_id', and 'client_secret'\n -f, --fields include fields\n --hidden include hidden lists (and fields)\n```\n\n## `netlink.sharepoint.base.Site`\n\nMain class representing a Sharepoint site. Can either be used directly providing the parameters\n\n- url\n- client_id\n- client_secret\n\nor inherited from\n\n```python\nfrom netlink.sharepoint.base import Site as _Site\n\n\nclass Site(_Site):\n _url = \"https://somewhere.sharepoint.com/sites/something\"\n _client_id = \"00000000-0000-0000-0000-000000000000\"\n _client_secret = \"abcdefghijklmnopqrstuvwxyz01234567890+/abcd=\"\n```\n\n### url\n\n_read-only_\n\n### users\n\n_read-only (always a copy of the actual data)_\n\nDict of the users of the site.\n\n| Column | Type | Description |\n|--------|:-----:|-----|\n| id | int | reference key for AuthorID, EditorID, etc. |\n| family_name | str | a.k.a. last name |\n| given_name | str | a.k.a. first name |\n| name | str | {family_name}, {given_name} |\n| email | str | |\n\n**Note** This is based on a default Sharepoint setup. This might not work for you.\n\n### get_list(name)\n\nReturns a Sharepoint List object (`office365.sharepoint.lists.list.List`) by **name**.\n\n### get_lists(hidden=False)\n\nReturns a list of Sharepoint List objects (`office365.sharepoint.lists.list.List`). If `hidden` is `True`, internal\nLists are included.\n\n### get_list_items(name)\n\nReturns list of all items (`office365.sharepoint.listitems.listitem.ListItem`) from **name**d Sharepoint List.\n\n### get_list_columns(name, hidden=False)\n\nReturns list of columns (a.k.a. Fields) of the **name**d Sharepoint List. If `hidden` is `True`, internal columns are\nincluded.\n\n### commit()\n\nSend all pending updates to Sharepoint.\n\n## `netlink.sharepoint.base.List`\n\nClass representing a Sharepoint List. This is a `collections.abc.Mapping`. Contents are mapped with the unique `id` of\nthe item in the Sharepoint List.\n\nWhen inherited from, class attribute\n\n- `_title` must be set.\n\n- `_map` should be set, but can be overridden. This maps the python name (best to use a valid attribute-name)\n to the respective internal Sharepoint name. Do not map 'id' or 'ID', this is done automatically as the primary key.\n\n- `_upper_case` can be set to be used in `normalize` to enforce that the respective columns are set to uppercase.\n\n- `_required` can be set to ensure that the respective columns are not empty (as defined by Python: `None`, empty\n string, or numeric zero).\n\nAt this point very optimistic (as in none-at-all) locking is used.\n\nThe item itself keeps information if data has been changed.\n\n### load()\n\nLoads all items from the Sharepoint List.\n\n### rollback()\n\nClears all local entries and calls `load`. At this time there is no difference, but when adding items will be supported,\nthis would clear them.\n\n### get(item, buffered=True)\n\nLoads (if nor already loaded) item based on unique `id`. If `buffered` is `False`, read from Sharepoint is forced.\n\n### commit()\n\nCommit all changed items to Sharepoint.\n\n### normalize()\n\nProcesses `_upper_case` for all items.\n\nConsider overriding this to set columns based on other columns.\n\n### validate()\n\nProcesses `_required` for all items.\n\nConsider overriding this to check list-wide constraints, like composite unique keys.\n\n## Item\n\nThis is a special class that gets build dynamically for each List. It is a `collections.abc.MutableMapping`.\n\nIt handles keeping state of changes and processes the actual mapping between Python and Sharepoint columns (fields).\n\n### commit(lazy=False)\n\nUpdate the internal `office365.sharepoint.listitems.listitem.ListItem` with any pending changes. If `lazy` is `True`,\nchanges are not sent to Sharepoint, providing the option to send on List or Site level.\n\n## License\n\nMIT\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Basic Tools for interaction with Sharepoint Sites",
"version": "0.0.8",
"project_urls": {
"Homepage": "https://gitlab.com/netlink_python/netlink-sharepoint-base",
"Repository": "https://gitlab.com/netlink_python/netlink-sharepoint-base"
},
"split_keywords": [
"sharepoint"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "6251b99b837a84d0d52ea84a4862297b12e98d6aab1fa435455f4c0c25661ae0",
"md5": "4cdf783a0f8f1efaf776078df6550b81",
"sha256": "47b01bf1b682e57226ad8f14bcfdb0e9608b3087f75a07cfac6885efd4d9d05a"
},
"downloads": -1,
"filename": "netlink_sharepoint_base-0.0.8-py3-none-any.whl",
"has_sig": false,
"md5_digest": "4cdf783a0f8f1efaf776078df6550b81",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<=3.12,>=3.8",
"size": 8570,
"upload_time": "2024-05-16T07:21:18",
"upload_time_iso_8601": "2024-05-16T07:21:18.183550Z",
"url": "https://files.pythonhosted.org/packages/62/51/b99b837a84d0d52ea84a4862297b12e98d6aab1fa435455f4c0c25661ae0/netlink_sharepoint_base-0.0.8-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "664bdcafa0fe65e701570c585facb9c97f9bd190c847374a7e5c423f2ce2ac93",
"md5": "1c9bdd79652b4d1ffd082f7ca93a2dd2",
"sha256": "f413d08cfb5e471a0a863be4d5d361aa17765d4b4f7c352ab4571ce94ae3c5c3"
},
"downloads": -1,
"filename": "netlink-sharepoint-base-0.0.8.tar.gz",
"has_sig": false,
"md5_digest": "1c9bdd79652b4d1ffd082f7ca93a2dd2",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<=3.12,>=3.8",
"size": 7163,
"upload_time": "2024-05-16T07:21:16",
"upload_time_iso_8601": "2024-05-16T07:21:16.467461Z",
"url": "https://files.pythonhosted.org/packages/66/4b/dcafa0fe65e701570c585facb9c97f9bd190c847374a7e5c423f2ce2ac93/netlink-sharepoint-base-0.0.8.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-16 07:21:16",
"github": false,
"gitlab": true,
"bitbucket": false,
"codeberg": false,
"gitlab_user": "netlink_python",
"gitlab_project": "netlink-sharepoint-base",
"lcname": "netlink-sharepoint-base"
}