microsoft-graph-devx-api icon indicating copy to clipboard operation
microsoft-graph-devx-api copied to clipboard

Python snippets do not import request bodies correctly

Open jasonjoh opened this issue 1 year ago • 1 comments

Context: https://github.com/microsoftgraph/microsoft-graph-docs-contrib/issues/9123

In the snippets the user reported, we see this line:

from msgraph.generated.models.provision_on_demand_post_request_body import ProvisionOnDemandPostRequestBody

This is invalid. The correct import statement is:

from msgraph.generated.service_principals.item.synchronization.jobs.item.provision_on_demand.provision_on_demand_post_request_body import ProvisionOnDemandPostRequestBody

This seems to be widespread across all Python snippets that use a special-purpose request body. For example, Send mail has:

from msgraph.generated.models.send_mail_post_request_body import SendMailPostRequestBody

But the correct line is:

from msgraph.generated.users.item.send_mail.send_mail_post_request_body import SendMailPostRequestBody

This is with msgraph-sdk 1.1.0

jasonjoh avatar Feb 21 '24 18:02 jasonjoh

I just encountered this issue as well with the Send mail documentation. Spent 30mins or so Googling and using ChatGPT with no luck until I stumbled across the issue here.

I really appreciate all the work that goes into maintaining this documentation and would be happy to submit a PR to help resolve this if I could determine where to submit this.

mrutherford2 avatar Apr 24 '24 17:04 mrutherford2