msgraph-sdk-python icon indicating copy to clipboard operation
msgraph-sdk-python copied to clipboard

Create TableRow API reference example raises TypeError "unexpected keyword argument 'values'"

Open jesperschlegel opened this issue 1 year ago • 3 comments

Describe the bug

Initializing a WorkbookTableRow as described in the API reference results in a TypeError.

Expected behavior

Correct initialization of a WorkbookTableRow in order to append a row to a workbook table.

How to reproduce

# from https://learn.microsoft.com/en-us/graph/api/table-post-rows?view=graph-rest-1.0&tabs=python
from msgraph.generated.models.workbook_table_row import WorkbookTableRow

request_body = WorkbookTableRow(
	values = [
		[
			1,
			2,
			3,
		],
		[
			4,
			5,
			6,
		],
	],
)

SDK Version

1.10.0

Latest version known to work for scenario above?

No response

Known Workarounds

No response

Debug output

Traceback (most recent call last):
  File "example.py", line 3, in <module>
    request_body = WorkbookTableRow(
TypeError: WorkbookTableRow.__init__() got an unexpected keyword argument 'values'

Configuration

No response

Other information

No response

jesperschlegel avatar Oct 09 '24 12:10 jesperschlegel

Hello @jesperschlegel thanks for using the SDK and for raising this.

Looking at what you're doing, and following this https://github.com/microsoftgraph/msgraph-sdk-python/blob/main/msgraph/generated/models/workbook_table_row.py

Looks like there is an issue in our snippets as the class does not have values atribute.

The ideal scenario for working with this Model would be:

from msgraph.generated.models.workbook_table_row import WorkbookTableRow

# Create an instance of WorkbookTableRow with numeric values
workbook_table_row_instance = WorkbookTableRow(
    index=5, odata_type="#microsoft.graph.workbookTableRow")

print(workbook_table_row_instance)

Considering your use case, what are you trying to achieve, is it to add rows to a workbook table, and populate the rows with some numeric data?

shemogumbe avatar Oct 16 '24 16:10 shemogumbe

That's exactly my use case. Can you provide some example code on how to achieve this?

jesperschlegel avatar Oct 16 '24 17:10 jesperschlegel

Any updates here? I'm having the same issue!

ignacio-kognitos avatar Nov 06 '24 15:11 ignacio-kognitos