sharepoint-v1-api 0.2.3__tar.gz → 0.2.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {sharepoint_v1_api-0.2.3 → sharepoint_v1_api-0.2.4}/CHANGELOG.md +8 -2
- {sharepoint_v1_api-0.2.3/sharepoint_v1_api.egg-info → sharepoint_v1_api-0.2.4}/PKG-INFO +9 -3
- {sharepoint_v1_api-0.2.3 → sharepoint_v1_api-0.2.4}/setup.py +1 -1
- {sharepoint_v1_api-0.2.3 → sharepoint_v1_api-0.2.4}/sharepoint_api/SharePointAPI.py +49 -14
- {sharepoint_v1_api-0.2.3 → sharepoint_v1_api-0.2.4}/sharepoint_api/SharePointList.py +2 -2
- {sharepoint_v1_api-0.2.3 → sharepoint_v1_api-0.2.4}/sharepoint_api/SharePointListItem.py +2 -2
- sharepoint_v1_api-0.2.4/sharepoint_api/SharePointSite.py +188 -0
- {sharepoint_v1_api-0.2.3 → sharepoint_v1_api-0.2.4}/sharepoint_api/SharePointTimeRegistration.py +1 -1
- {sharepoint_v1_api-0.2.3 → sharepoint_v1_api-0.2.4}/sharepoint_api/__init__.py +3 -2
- {sharepoint_v1_api-0.2.3 → sharepoint_v1_api-0.2.4/sharepoint_v1_api.egg-info}/PKG-INFO +9 -3
- {sharepoint_v1_api-0.2.3 → sharepoint_v1_api-0.2.4}/sharepoint_v1_api.egg-info/SOURCES.txt +1 -0
- {sharepoint_v1_api-0.2.3 → sharepoint_v1_api-0.2.4}/AGENTS.md +0 -0
- {sharepoint_v1_api-0.2.3 → sharepoint_v1_api-0.2.4}/LICENSE +0 -0
- {sharepoint_v1_api-0.2.3 → sharepoint_v1_api-0.2.4}/MANIFEST.in +0 -0
- {sharepoint_v1_api-0.2.3 → sharepoint_v1_api-0.2.4}/README.md +0 -0
- {sharepoint_v1_api-0.2.3 → sharepoint_v1_api-0.2.4}/pyproject.toml +0 -0
- {sharepoint_v1_api-0.2.3 → sharepoint_v1_api-0.2.4}/setup.cfg +0 -0
- {sharepoint_v1_api-0.2.3 → sharepoint_v1_api-0.2.4}/sharepoint_api/SharePointLists.py +0 -0
- {sharepoint_v1_api-0.2.3 → sharepoint_v1_api-0.2.4}/sharepoint_api/SharePointUser.py +0 -0
- {sharepoint_v1_api-0.2.3 → sharepoint_v1_api-0.2.4}/sharepoint_api/SharePointUserList.py +0 -0
- {sharepoint_v1_api-0.2.3 → sharepoint_v1_api-0.2.4}/sharepoint_v1_api.egg-info/dependency_links.txt +0 -0
- {sharepoint_v1_api-0.2.3 → sharepoint_v1_api-0.2.4}/sharepoint_v1_api.egg-info/requires.txt +0 -0
- {sharepoint_v1_api-0.2.3 → sharepoint_v1_api-0.2.4}/sharepoint_v1_api.egg-info/top_level.txt +0 -0
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## 0.2.4 – 2025-12-03
|
|
2
|
+
|
|
3
|
+
### Added
|
|
4
|
+
|
|
5
|
+
- New high‑level `SharePointSite` object providing lazy‑loaded site metadata
|
|
6
|
+
|
|
1
7
|
## 0.2.3 – 2025-12-02
|
|
2
8
|
|
|
3
9
|
### Added
|
|
@@ -22,7 +28,7 @@
|
|
|
22
28
|
|
|
23
29
|
- `SharePointList.fields` property to retrieve list field definitions
|
|
24
30
|
|
|
25
|
-
## 0.2.1 – 2025
|
|
31
|
+
## 0.2.1 – 2025-11-06
|
|
26
32
|
|
|
27
33
|
### Added
|
|
28
34
|
|
|
@@ -34,7 +40,7 @@
|
|
|
34
40
|
|
|
35
41
|
### Changed
|
|
36
42
|
|
|
37
|
-
- HTTP header handling unified; corrected `X
|
|
43
|
+
- HTTP header handling unified; corrected `X-HTTP-Method: PUT` for full updates.
|
|
38
44
|
- Error handling improved: generic `sys.exit(1)` replaced with explicit `TypeError`/`ConnectionError` exceptions.
|
|
39
45
|
|
|
40
46
|
### Fixed
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sharepoint_v1_api
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.4
|
|
4
4
|
Author: Aske Bluhme Klok
|
|
5
5
|
License: MIT
|
|
6
6
|
Keywords: Sharepoint
|
|
@@ -156,6 +156,12 @@ for v in versions:
|
|
|
156
156
|
```
|
|
157
157
|
|
|
158
158
|
|
|
159
|
+
## 0.2.4 – 2025-12-03
|
|
160
|
+
|
|
161
|
+
### Added
|
|
162
|
+
|
|
163
|
+
- New high‑level `SharePointSite` object providing lazy‑loaded site metadata
|
|
164
|
+
|
|
159
165
|
## 0.2.3 – 2025-12-02
|
|
160
166
|
|
|
161
167
|
### Added
|
|
@@ -180,7 +186,7 @@ for v in versions:
|
|
|
180
186
|
|
|
181
187
|
- `SharePointList.fields` property to retrieve list field definitions
|
|
182
188
|
|
|
183
|
-
## 0.2.1 – 2025
|
|
189
|
+
## 0.2.1 – 2025-11-06
|
|
184
190
|
|
|
185
191
|
### Added
|
|
186
192
|
|
|
@@ -192,7 +198,7 @@ for v in versions:
|
|
|
192
198
|
|
|
193
199
|
### Changed
|
|
194
200
|
|
|
195
|
-
- HTTP header handling unified; corrected `X
|
|
201
|
+
- HTTP header handling unified; corrected `X-HTTP-Method: PUT` for full updates.
|
|
196
202
|
- Error handling improved: generic `sys.exit(1)` replaced with explicit `TypeError`/`ConnectionError` exceptions.
|
|
197
203
|
|
|
198
204
|
### Fixed
|
|
@@ -11,13 +11,14 @@ from .SharePointUserList import SharePointUserList
|
|
|
11
11
|
from .SharePointListItem import SharePointListItem, SharepointSiteCase
|
|
12
12
|
from .SharePointList import SharePointList, CasesList, TimeRegistrationList
|
|
13
13
|
from .SharePointLists import SharePointLists
|
|
14
|
+
from .SharePointSite import SharePointSite
|
|
14
15
|
|
|
15
16
|
|
|
16
17
|
class SharePointAPI:
|
|
17
|
-
"""High
|
|
18
|
+
"""High-level client for interacting with SharePoint sites.
|
|
18
19
|
|
|
19
20
|
Provides methods for authentication, list management, file operations,
|
|
20
|
-
and time
|
|
21
|
+
and time-registration handling. All public interactions should be performed
|
|
21
22
|
through an instance created via :meth:`_compact_init`.
|
|
22
23
|
"""
|
|
23
24
|
|
|
@@ -35,7 +36,7 @@ class SharePointAPI:
|
|
|
35
36
|
Returns
|
|
36
37
|
-------
|
|
37
38
|
SharePointAPI
|
|
38
|
-
A fully
|
|
39
|
+
A fully-initialised ``SharePointAPI`` object ready for use.
|
|
39
40
|
|
|
40
41
|
Notes
|
|
41
42
|
-----
|
|
@@ -177,7 +178,7 @@ class SharePointAPI:
|
|
|
177
178
|
Perform a POST request against the SharePoint REST API.
|
|
178
179
|
|
|
179
180
|
Enhanced error handling:
|
|
180
|
-
* Network
|
|
181
|
+
* Network-level errors (timeouts, DNS failures, etc.) are caught and re-raised as
|
|
181
182
|
``ConnectionError`` with a helpful message.
|
|
182
183
|
* HTTP error codes are reported with status, URL and response body when available.
|
|
183
184
|
* The method always returns a ``requests.Response`` on success (status 200, 201 or 204).
|
|
@@ -187,7 +188,7 @@ class SharePointAPI:
|
|
|
187
188
|
url : str
|
|
188
189
|
The full endpoint URL.
|
|
189
190
|
post_data : dict
|
|
190
|
-
JSON
|
|
191
|
+
JSON-serialisable payload to send.
|
|
191
192
|
form_digest_value : str | None, optional
|
|
192
193
|
FormDigest required for POST/PUT/MERGE operations.
|
|
193
194
|
merge : bool, optional
|
|
@@ -238,7 +239,7 @@ class SharePointAPI:
|
|
|
238
239
|
Perform a PUT request against the SharePoint REST API.
|
|
239
240
|
|
|
240
241
|
Enhanced error handling:
|
|
241
|
-
* Network
|
|
242
|
+
* Network-level errors (timeouts, DNS failures, etc.) are caught and re-raised as
|
|
242
243
|
``ConnectionError`` with a helpful message.
|
|
243
244
|
* HTTP error codes are reported with status, URL and response body when available.
|
|
244
245
|
* The method always returns a ``requests.Response`` on success (status 200, 201 or 204).
|
|
@@ -248,7 +249,7 @@ class SharePointAPI:
|
|
|
248
249
|
url : str
|
|
249
250
|
The full endpoint URL.
|
|
250
251
|
put_data : dict
|
|
251
|
-
JSON
|
|
252
|
+
JSON-serialisable payload to send.
|
|
252
253
|
form_digest_value : str | None, optional
|
|
253
254
|
FormDigest required for POST/PUT/MERGE operations.
|
|
254
255
|
merge : bool, optional
|
|
@@ -295,10 +296,10 @@ class SharePointAPI:
|
|
|
295
296
|
def _api_attachment_call(self, url: str, post_data: bytes | None = None, form_digest_value: str | None = None,
|
|
296
297
|
overwrite: bool = False, x_http_method: str | None = None) -> requests.Response:
|
|
297
298
|
"""
|
|
298
|
-
Perform an attachment
|
|
299
|
+
Perform an attachment-related request (POST, PUT, DELETE) against the SharePoint REST API.
|
|
299
300
|
|
|
300
301
|
Enhanced error handling:
|
|
301
|
-
* Network
|
|
302
|
+
* Network-level errors (timeouts, DNS failures, etc.) are caught and re-raised as
|
|
302
303
|
``ConnectionError`` with a helpful message.
|
|
303
304
|
* HTTP error codes are reported with status, URL and response body when available.
|
|
304
305
|
* The method always returns a ``requests.Response`` on success (status 200 or 204).
|
|
@@ -323,7 +324,7 @@ class SharePointAPI:
|
|
|
323
324
|
'X-RequestDigest': f'{form_digest_value}'
|
|
324
325
|
}
|
|
325
326
|
|
|
326
|
-
# Determine effective X
|
|
327
|
+
# Determine effective X-HTTP-Method
|
|
327
328
|
if overwrite:
|
|
328
329
|
headers['X-HTTP-Method'] = "PUT"
|
|
329
330
|
if x_http_method:
|
|
@@ -337,7 +338,7 @@ class SharePointAPI:
|
|
|
337
338
|
raise ConnectionError(
|
|
338
339
|
f'Unsupported X-HTTP-Method: {x_http_method}')
|
|
339
340
|
|
|
340
|
-
# Add Content
|
|
341
|
+
# Add Content-Length when payload present
|
|
341
342
|
if post_data is not None:
|
|
342
343
|
headers['Content-Length'] = str(len(post_data))
|
|
343
344
|
|
|
@@ -365,7 +366,7 @@ class SharePointAPI:
|
|
|
365
366
|
Perform a GET request against the SharePoint REST API.
|
|
366
367
|
|
|
367
368
|
Enhanced error handling:
|
|
368
|
-
* Network
|
|
369
|
+
* Network-level errors (timeouts, DNS failures, etc.) are caught and re-raised as
|
|
369
370
|
``ConnectionError`` with a helpful message.
|
|
370
371
|
* HTTP error codes are reported with status, URL and response body when available.
|
|
371
372
|
* The method always returns a ``requests.Response`` on success (status 200).
|
|
@@ -462,7 +463,7 @@ class SharePointAPI:
|
|
|
462
463
|
Returns
|
|
463
464
|
-------
|
|
464
465
|
SharePointUserList
|
|
465
|
-
A list
|
|
466
|
+
A list-like container with :class:`SharePointUser` objects for each member.
|
|
466
467
|
"""
|
|
467
468
|
# Build the request URL for the group's users.
|
|
468
469
|
# SharePoint REST endpoint: /_api/web/sitegroups/GetByName('<group_name>')/users
|
|
@@ -503,7 +504,7 @@ class SharePointAPI:
|
|
|
503
504
|
for user_settings in r.json()["d"]["results"]
|
|
504
505
|
]
|
|
505
506
|
|
|
506
|
-
# Return a ``SharePointUserList`` (consistent with other user
|
|
507
|
+
# Return a ``SharePointUserList`` (consistent with other user-retrieval methods).
|
|
507
508
|
return SharePointUserList(sharepoint_site, users)
|
|
508
509
|
|
|
509
510
|
def get_user(self, sharepoint_site, user_id, select_fields=None):
|
|
@@ -554,6 +555,40 @@ class SharePointAPI:
|
|
|
554
555
|
|
|
555
556
|
return SharePointLists(_lists)
|
|
556
557
|
|
|
558
|
+
def get_site_metadata(self, sharepoint_site: str) -> dict:
|
|
559
|
+
"""
|
|
560
|
+
Retrieve metadata of a SharePoint site.
|
|
561
|
+
|
|
562
|
+
Parameters
|
|
563
|
+
----------
|
|
564
|
+
sharepoint_site : str
|
|
565
|
+
Identifier of the SharePoint site (e.g., 'mySite').
|
|
566
|
+
|
|
567
|
+
Returns
|
|
568
|
+
-------
|
|
569
|
+
dict
|
|
570
|
+
Dictionary containing the site's metadata as returned by the SharePoint REST API.
|
|
571
|
+
"""
|
|
572
|
+
r = self._api_get_call(
|
|
573
|
+
f'{self.sharepoint_url}/cases/{sharepoint_site}/_api/Web')
|
|
574
|
+
return r.json()["d"]
|
|
575
|
+
|
|
576
|
+
def get_site(self, sharepoint_site: str) -> SharePointSite:
|
|
577
|
+
"""
|
|
578
|
+
Return a :class:`SharePointSite` object representing the given site.
|
|
579
|
+
|
|
580
|
+
Parameters
|
|
581
|
+
----------
|
|
582
|
+
sharepoint_site : str
|
|
583
|
+
Identifier of the SharePoint site (e.g., ``'mySite'``).
|
|
584
|
+
|
|
585
|
+
Returns
|
|
586
|
+
-------
|
|
587
|
+
SharePointSite
|
|
588
|
+
A high-level wrapper around site-wide operations.
|
|
589
|
+
"""
|
|
590
|
+
return SharePointSite(self, sharepoint_site)
|
|
591
|
+
|
|
557
592
|
def get_list(self, sharepoint_site, sp_list, filters=None, top=1000, view_path=None, select_fields=None, SPListType: SharePointList = SharePointList) -> SharePointList:
|
|
558
593
|
'''
|
|
559
594
|
Returns a list from a given sharepoint_site using its guid
|
|
@@ -12,7 +12,7 @@ class SharePointList:
|
|
|
12
12
|
Provides common functionality for handling list items, including
|
|
13
13
|
retrieval, addition, and serialization to JSON. Subclasses such as
|
|
14
14
|
:class:`CasesList` and :class:`TimeRegistrationList` extend this
|
|
15
|
-
class with domain
|
|
15
|
+
class with domain-specific behavior.
|
|
16
16
|
"""
|
|
17
17
|
|
|
18
18
|
settings = None
|
|
@@ -194,7 +194,7 @@ class CasesList(SharePointList):
|
|
|
194
194
|
|
|
195
195
|
class TimeRegistrationList(SharePointList):
|
|
196
196
|
"""
|
|
197
|
-
Specialized list for time
|
|
197
|
+
Specialized list for time-registration entries.
|
|
198
198
|
|
|
199
199
|
Inherits from :class:`SharePointList` and sets ``SPItem`` to the
|
|
200
200
|
:class:`TimeRegistration` class.
|
|
@@ -8,8 +8,8 @@ class SharePointListItem:
|
|
|
8
8
|
|
|
9
9
|
Provides access to common fields such as ``Id``, ``Title``, ``Created`` and
|
|
10
10
|
``Modified`` and handles lazy loading of related list data and version
|
|
11
|
-
history. Sub
|
|
12
|
-
:class:`TimeRegistration`) extend this base with domain
|
|
11
|
+
history. Sub-classes (e.g. :class:`SharepointSiteCase` or
|
|
12
|
+
:class:`TimeRegistration`) extend this base with domain-specific properties.
|
|
13
13
|
"""
|
|
14
14
|
'''
|
|
15
15
|
'''
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Provides a high-level ``SharePointSite`` object that encapsulates site-wide
|
|
3
|
+
metadata and offers convenience wrappers around common ``SharePointAPI``
|
|
4
|
+
operations such as retrieving lists, users, and groups.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
from datetime import datetime
|
|
9
|
+
|
|
10
|
+
from typing import List, Optional
|
|
11
|
+
import locale
|
|
12
|
+
|
|
13
|
+
from typing import TYPE_CHECKING
|
|
14
|
+
|
|
15
|
+
if TYPE_CHECKING:
|
|
16
|
+
# Imported only for type checking to avoid circular imports at runtime
|
|
17
|
+
from .SharePointAPI import SharePointAPI
|
|
18
|
+
from .SharePointList import SharePointList
|
|
19
|
+
from .SharePointLists import SharePointLists
|
|
20
|
+
from .SharePointUser import SharePointUser
|
|
21
|
+
from .SharePointUserList import SharePointUserList
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class SharePointSite:
|
|
25
|
+
"""
|
|
26
|
+
High-level representation of a SharePoint site.
|
|
27
|
+
|
|
28
|
+
Parameters
|
|
29
|
+
----------
|
|
30
|
+
api : SharePointAPI
|
|
31
|
+
The low-level client used for HTTP calls.
|
|
32
|
+
site_id : str
|
|
33
|
+
Identifier of the SharePoint site (e.g. ``"mySite"``).
|
|
34
|
+
"""
|
|
35
|
+
|
|
36
|
+
def __init__(self, api: "SharePointAPI", site_id: str):
|
|
37
|
+
self._api = api
|
|
38
|
+
self.site_id = site_id
|
|
39
|
+
self._metadata: Optional[dict] = None
|
|
40
|
+
|
|
41
|
+
# -----------------------------------------------------------------
|
|
42
|
+
# Internal helpers
|
|
43
|
+
# -----------------------------------------------------------------
|
|
44
|
+
def _ensure_metadata(self) -> dict:
|
|
45
|
+
"""Fetch site metadata on first use and cache it."""
|
|
46
|
+
if self._metadata is None:
|
|
47
|
+
self._metadata = self._api.get_site_metadata(self.site_id)
|
|
48
|
+
return self._metadata
|
|
49
|
+
|
|
50
|
+
# -----------------------------------------------------------------
|
|
51
|
+
# Exposed properties (lazy-loaded)
|
|
52
|
+
# -----------------------------------------------------------------
|
|
53
|
+
@property
|
|
54
|
+
def title(self) -> str:
|
|
55
|
+
"""Site title."""
|
|
56
|
+
return self._ensure_metadata().get("Title", "")
|
|
57
|
+
|
|
58
|
+
@property
|
|
59
|
+
def url(self) -> str:
|
|
60
|
+
"""Absolute URL of the site."""
|
|
61
|
+
return self._ensure_metadata().get("Url", "")
|
|
62
|
+
|
|
63
|
+
@property
|
|
64
|
+
def description(self) -> str:
|
|
65
|
+
"""Site description, if present."""
|
|
66
|
+
return self._ensure_metadata().get("Description", "")
|
|
67
|
+
|
|
68
|
+
@property
|
|
69
|
+
def created(self) -> datetime | None:
|
|
70
|
+
"""
|
|
71
|
+
Creation date of the SharePoint site.
|
|
72
|
+
|
|
73
|
+
Returns a ``datetime`` object parsed from the ``Created`` metadata
|
|
74
|
+
field, or ``None`` if the field is missing or cannot be parsed.
|
|
75
|
+
"""
|
|
76
|
+
created_str = self._ensure_metadata().get("Created")
|
|
77
|
+
if not created_str:
|
|
78
|
+
return None
|
|
79
|
+
try:
|
|
80
|
+
# ``fromisoformat`` handles the ISO‑8601 format returned by SharePoint.
|
|
81
|
+
return datetime.fromisoformat(created_str)
|
|
82
|
+
except ValueError:
|
|
83
|
+
# Fallback: return None if parsing fails.
|
|
84
|
+
return None
|
|
85
|
+
|
|
86
|
+
@property
|
|
87
|
+
def language_id(self) -> int:
|
|
88
|
+
"""Raw LCID value returned by SharePoint."""
|
|
89
|
+
return self._ensure_metadata().get("Language", 0)
|
|
90
|
+
|
|
91
|
+
@property
|
|
92
|
+
def language_name(self) -> str:
|
|
93
|
+
"""
|
|
94
|
+
Human-readable language name derived from the LCID using the
|
|
95
|
+
``locale`` module. If the LCID is unknown or the locale cannot be set,
|
|
96
|
+
a fallback string is returned.
|
|
97
|
+
"""
|
|
98
|
+
lcid = self.language_id
|
|
99
|
+
locale_code = locale.windows_locale.get(lcid)
|
|
100
|
+
if not locale_code:
|
|
101
|
+
return f"Unknown (LCID={lcid})"
|
|
102
|
+
try:
|
|
103
|
+
# Attempt to set the locale; may fail if not installed.
|
|
104
|
+
locale.setlocale(locale.LC_ALL, locale_code)
|
|
105
|
+
# locale.getlocale() returns a tuple like ('en_US', 'UTF-8')
|
|
106
|
+
loc = locale.getlocale()[0]
|
|
107
|
+
if loc:
|
|
108
|
+
# Return the locale identifier (e.g., 'en_US')
|
|
109
|
+
return loc
|
|
110
|
+
except locale.Error:
|
|
111
|
+
# Locale not available on the system; fall back to the code.
|
|
112
|
+
pass
|
|
113
|
+
# Fallback to the raw locale code string.
|
|
114
|
+
return locale_code
|
|
115
|
+
|
|
116
|
+
# -----------------------------------------------------------------
|
|
117
|
+
# Convenience wrappers around ``SharePointAPI`` methods
|
|
118
|
+
# -----------------------------------------------------------------
|
|
119
|
+
def get_lists(self) -> SharePointLists:
|
|
120
|
+
"""Return a ``SharePointLists`` collection for this site."""
|
|
121
|
+
return self._api.get_lists(self.site_id)
|
|
122
|
+
|
|
123
|
+
def get_users(
|
|
124
|
+
self,
|
|
125
|
+
filters: Optional[str] = None,
|
|
126
|
+
select_fields: Optional[List[str]] = None,
|
|
127
|
+
) -> SharePointUserList:
|
|
128
|
+
"""Retrieve users from the site."""
|
|
129
|
+
return self._api.get_users(self.site_id, filters=filters, select_fields=select_fields)
|
|
130
|
+
|
|
131
|
+
def get_group_users(
|
|
132
|
+
self,
|
|
133
|
+
group_name: str,
|
|
134
|
+
filters: Optional[str] = None,
|
|
135
|
+
select_fields: Optional[List[str]] = None,
|
|
136
|
+
) -> SharePointUserList:
|
|
137
|
+
"""Retrieve members of a SharePoint group."""
|
|
138
|
+
return self._api.get_group_users(
|
|
139
|
+
self.site_id, group_name, filters=filters, select_fields=select_fields
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
def get_user(
|
|
143
|
+
self,
|
|
144
|
+
user_id: int,
|
|
145
|
+
select_fields: Optional[List[str]] = None,
|
|
146
|
+
) -> SharePointUser:
|
|
147
|
+
"""Retrieve a single user by ID."""
|
|
148
|
+
return self._api.get_user(self.site_id, user_id, select_fields=select_fields)
|
|
149
|
+
|
|
150
|
+
def get_list(
|
|
151
|
+
self,
|
|
152
|
+
sp_list,
|
|
153
|
+
filters=None,
|
|
154
|
+
top: int = 1000,
|
|
155
|
+
view_path=None,
|
|
156
|
+
select_fields=None,
|
|
157
|
+
SPListType: SharePointList = SharePointList,
|
|
158
|
+
) -> SharePointList:
|
|
159
|
+
"""Delegate to ``SharePointAPI.get_list`` for this site."""
|
|
160
|
+
return self._api.get_list(
|
|
161
|
+
self.site_id,
|
|
162
|
+
sp_list,
|
|
163
|
+
filters,
|
|
164
|
+
top,
|
|
165
|
+
view_path,
|
|
166
|
+
select_fields,
|
|
167
|
+
SPListType=SPListType,
|
|
168
|
+
)
|
|
169
|
+
|
|
170
|
+
def get_list_by_name(
|
|
171
|
+
self,
|
|
172
|
+
sp_list_name: str,
|
|
173
|
+
filters=None,
|
|
174
|
+
top: int = 1000,
|
|
175
|
+
view_path=None,
|
|
176
|
+
select_fields=None,
|
|
177
|
+
SPListType: SharePointList = SharePointList,
|
|
178
|
+
) -> SharePointList:
|
|
179
|
+
"""Delegate to ``SharePointAPI.get_list_by_name`` for this site."""
|
|
180
|
+
return self._api.get_list_by_name(
|
|
181
|
+
self.site_id,
|
|
182
|
+
sp_list_name,
|
|
183
|
+
filters,
|
|
184
|
+
top,
|
|
185
|
+
view_path,
|
|
186
|
+
select_fields,
|
|
187
|
+
SPListType=SPListType,
|
|
188
|
+
)
|
{sharepoint_v1_api-0.2.3 → sharepoint_v1_api-0.2.4}/sharepoint_api/SharePointTimeRegistration.py
RENAMED
|
@@ -6,7 +6,7 @@ from sharepoint_api.SharePointListItem import SharePointListItem
|
|
|
6
6
|
|
|
7
7
|
class TimeRegistration(SharePointListItem):
|
|
8
8
|
"""
|
|
9
|
-
Represents a time
|
|
9
|
+
Represents a time-registration entry associated with a SharePoint list item.
|
|
10
10
|
|
|
11
11
|
Extends :class:`SharePointListItem` with fields specific to time tracking,
|
|
12
12
|
such as ``Hours``, ``DoneBy`` and related timestamps. Provides lazy loading of the
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""sharepoint_api package
|
|
2
2
|
|
|
3
|
-
Provides a high
|
|
3
|
+
Provides a high-level Python client for interacting with SharePoint sites via the
|
|
4
4
|
`SharePointAPI` class. The package includes helpers for working with lists,
|
|
5
5
|
list items, users, and time registrations.
|
|
6
6
|
|
|
@@ -18,4 +18,5 @@ api = SharePointAPI._compact_init(creds)
|
|
|
18
18
|
```
|
|
19
19
|
"""
|
|
20
20
|
|
|
21
|
-
from .SharePointAPI import SharePointAPI
|
|
21
|
+
from .SharePointAPI import SharePointAPI
|
|
22
|
+
from .SharePointSite import SharePointSite
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sharepoint_v1_api
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.4
|
|
4
4
|
Author: Aske Bluhme Klok
|
|
5
5
|
License: MIT
|
|
6
6
|
Keywords: Sharepoint
|
|
@@ -156,6 +156,12 @@ for v in versions:
|
|
|
156
156
|
```
|
|
157
157
|
|
|
158
158
|
|
|
159
|
+
## 0.2.4 – 2025-12-03
|
|
160
|
+
|
|
161
|
+
### Added
|
|
162
|
+
|
|
163
|
+
- New high‑level `SharePointSite` object providing lazy‑loaded site metadata
|
|
164
|
+
|
|
159
165
|
## 0.2.3 – 2025-12-02
|
|
160
166
|
|
|
161
167
|
### Added
|
|
@@ -180,7 +186,7 @@ for v in versions:
|
|
|
180
186
|
|
|
181
187
|
- `SharePointList.fields` property to retrieve list field definitions
|
|
182
188
|
|
|
183
|
-
## 0.2.1 – 2025
|
|
189
|
+
## 0.2.1 – 2025-11-06
|
|
184
190
|
|
|
185
191
|
### Added
|
|
186
192
|
|
|
@@ -192,7 +198,7 @@ for v in versions:
|
|
|
192
198
|
|
|
193
199
|
### Changed
|
|
194
200
|
|
|
195
|
-
- HTTP header handling unified; corrected `X
|
|
201
|
+
- HTTP header handling unified; corrected `X-HTTP-Method: PUT` for full updates.
|
|
196
202
|
- Error handling improved: generic `sys.exit(1)` replaced with explicit `TypeError`/`ConnectionError` exceptions.
|
|
197
203
|
|
|
198
204
|
### Fixed
|
|
@@ -9,6 +9,7 @@ sharepoint_api/SharePointAPI.py
|
|
|
9
9
|
sharepoint_api/SharePointList.py
|
|
10
10
|
sharepoint_api/SharePointListItem.py
|
|
11
11
|
sharepoint_api/SharePointLists.py
|
|
12
|
+
sharepoint_api/SharePointSite.py
|
|
12
13
|
sharepoint_api/SharePointTimeRegistration.py
|
|
13
14
|
sharepoint_api/SharePointUser.py
|
|
14
15
|
sharepoint_api/SharePointUserList.py
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sharepoint_v1_api-0.2.3 → sharepoint_v1_api-0.2.4}/sharepoint_v1_api.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
{sharepoint_v1_api-0.2.3 → sharepoint_v1_api-0.2.4}/sharepoint_v1_api.egg-info/top_level.txt
RENAMED
|
File without changes
|