You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .claude/skills/dataverse-sdk-use/SKILL.md
+5-4Lines changed: 5 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,6 +21,7 @@ Use the PowerPlatform Dataverse Client Python SDK to interact with Microsoft Dat
21
21
-`client.records` -- CRUD and OData queries
22
22
-`client.query` -- query and search operations
23
23
-`client.tables` -- table metadata, columns, and relationships
24
+
-`client.files` -- file upload operations
24
25
25
26
### Bulk Operations
26
27
The SDK supports Dataverse's native bulk operations: Pass lists to `create()`, `update()` for automatic bulk processing, for `delete()`, set `use_bulk_delete` when passing lists to use bulk operation
Copy file name to clipboardExpand all lines: README.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -112,8 +112,8 @@ The SDK provides a simple, pythonic interface for Dataverse operations:
112
112
113
113
| Concept | Description |
114
114
|---------|-------------|
115
-
|**DataverseClient**| Main entry point; provides `records`, `query`, and `tables` namespaces |
116
-
|**Namespaces**| Operations are organized into `client.records` (CRUD & OData queries), `client.query` (query & search), and `client.tables` (metadata) |
115
+
|**DataverseClient**| Main entry point; provides `records`, `query`, `tables`, and `files` namespaces |
116
+
|**Namespaces**| Operations are organized into `client.records` (CRUD & OData queries), `client.query` (query & search), `client.tables` (metadata), and `client.files` (file uploads) |
117
117
|**Records**| Dataverse records represented as Python dictionaries with column schema names |
118
118
|**Schema names**| Use table schema names (`"account"`, `"new_MyTestTable"`) and column schema names (`"name"`, `"new_MyTestColumn"`). See: [Table definitions in Microsoft Dataverse](https://learn.microsoft.com/en-us/power-apps/developer/data-platform/entity-metadata)|
119
119
|**Bulk Operations**| Efficient bulk processing for multiple records with automatic optimization |
@@ -378,11 +378,11 @@ result = client.tables.create_lookup_field(
378
378
379
379
```python
380
380
# Upload a file to a record
381
-
client.upload_file(
382
-
table_schema_name="account",
383
-
record_id=account_id,
384
-
file_name_attribute="new_Document", # If the file column doesn't exist, it will be created automatically
385
-
path="/path/to/document.pdf"
381
+
client.files.upload(
382
+
"account",
383
+
account_id,
384
+
"new_Document", # If the file column doesn't exist, it will be created automatically
Copy file name to clipboardExpand all lines: src/PowerPlatform/Dataverse/claude_skill/dataverse-sdk-use/SKILL.md
+5-4Lines changed: 5 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,6 +21,7 @@ Use the PowerPlatform Dataverse Client Python SDK to interact with Microsoft Dat
21
21
-`client.records` -- CRUD and OData queries
22
22
-`client.query` -- query and search operations
23
23
-`client.tables` -- table metadata, columns, and relationships
24
+
-`client.files` -- file upload operations
24
25
25
26
### Bulk Operations
26
27
The SDK supports Dataverse's native bulk operations: Pass lists to `create()`, `update()` for automatic bulk processing, for `delete()`, set `use_bulk_delete` when passing lists to use bulk operation
Copy file name to clipboardExpand all lines: src/PowerPlatform/Dataverse/client.py
+26-49Lines changed: 26 additions & 49 deletions
Original file line number
Diff line number
Diff line change
@@ -14,6 +14,7 @@
14
14
from .data._odataimport_ODataClient
15
15
from .operations.recordsimportRecordOperations
16
16
from .operations.queryimportQueryOperations
17
+
from .operations.filesimportFileOperations
17
18
from .operations.tablesimportTableOperations
18
19
19
20
@@ -56,6 +57,7 @@ class DataverseClient:
56
57
- ``client.records`` -- create, update, delete, and get records (single or paginated queries)
57
58
- ``client.query`` -- query and search operations
58
59
- ``client.tables`` -- table and column metadata management
60
+
- ``client.files`` -- file upload operations
59
61
60
62
Example:
61
63
Create a client and perform basic operations::
@@ -101,6 +103,7 @@ def __init__(
101
103
self.records=RecordOperations(self)
102
104
self.query=QueryOperations(self)
103
105
self.tables=TableOperations(self)
106
+
self.files=FileOperations(self)
104
107
105
108
def_get_odata(self) ->_ODataClient:
106
109
"""
@@ -665,67 +668,41 @@ def upload_file(
665
668
if_none_match: bool=True,
666
669
) ->None:
667
670
"""
671
+
.. note::
672
+
Deprecated. Use :meth:`~PowerPlatform.Dataverse.operations.files.FileOperations.upload` instead.
673
+
668
674
Upload a file to a Dataverse file column.
669
675
670
-
:param table_schema_name: Schema name of the table, e.g. ``"account"`` or ``"new_MyTestTable"``.
676
+
:param table_schema_name: Schema name of the table.
671
677
:type table_schema_name: :class:`str`
672
678
:param record_id: GUID of the target record.
673
679
:type record_id: :class:`str`
674
-
:param file_name_attribute: Schema name of the file column attribute (e.g., ``"new_Document"``). If the column doesn't exist, it will be created automatically.
680
+
:param file_name_attribute: Schema name of the file column attribute.
675
681
:type file_name_attribute: :class:`str`
676
-
:param path: Local filesystem path to the file. The stored filename will be
677
-
the basename of this path.
682
+
:param path: Local filesystem path to the file.
678
683
:type path: :class:`str`
679
684
:param mode: Upload strategy: ``"auto"`` (default), ``"small"``, or ``"chunk"``.
680
-
Auto mode selects small or chunked upload based on file size.
681
685
:type mode: :class:`str` or None
682
-
:param mime_type: Explicit MIME type to store with the file (e.g. ``"application/pdf"``).
683
-
If not provided, the MIME type may be inferred from the file extension.
686
+
:param mime_type: Explicit MIME type to store with the file.
684
687
:type mime_type: :class:`str` or None
685
-
:param if_none_match: When True (default), sends ``If-None-Match: null`` header to only
686
-
succeed if the column is currently empty. Set False to always overwrite using
687
-
``If-Match: *``. Used for small and chunk modes only.
688
+
:param if_none_match: When True (default), only succeed if the column is
689
+
currently empty.
688
690
:type if_none_match: :class:`bool`
689
-
690
-
:raises ~PowerPlatform.Dataverse.core.errors.HttpError: If the upload fails or the file column is not empty
691
-
when ``if_none_match=True``.
692
-
:raises FileNotFoundError: If the specified file path does not exist.
693
-
694
-
.. note::
695
-
Large files are automatically chunked to avoid request size limits. The chunk mode performs multiple requests with resumable upload support.
696
-
697
-
Example:
698
-
Upload a PDF file::
699
-
700
-
client.upload_file(
701
-
table_schema_name="account",
702
-
record_id=account_id,
703
-
file_name_attribute="new_Contract",
704
-
path="/path/to/contract.pdf",
705
-
mime_type="application/pdf"
706
-
)
707
-
708
-
Upload with auto mode selection::
709
-
710
-
client.upload_file(
711
-
table_schema_name="email",
712
-
record_id=email_id,
713
-
file_name_attribute="new_Attachment",
714
-
path="/path/to/large_file.zip",
715
-
mode="auto"
716
-
)
717
691
"""
718
-
withself._scoped_odata() asod:
719
-
od._upload_file(
720
-
table_schema_name,
721
-
record_id,
722
-
file_name_attribute,
723
-
path,
724
-
mode=mode,
725
-
mime_type=mime_type,
726
-
if_none_match=if_none_match,
727
-
)
728
-
returnNone
692
+
warnings.warn(
693
+
"client.upload_file() is deprecated. Use client.files.upload() instead.",
0 commit comments