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

Question: How do I construct the delta research query ?

Open atdiausx2 opened this issue 2 years ago • 2 comments

This library looks like lacking many more examples of less simplistic queries using graph api for Python .

I am trying to understand how I can delta sync the data using DeltaRequestBuilder that is advocated so much in the documentation, but after installing this package I cannot even find how to import this module from msgraph. I know I can use another library msgraph-core but it is not ideal either and most examples in Microsoft docs exemplify this library. They do not, however, direct to some comprehensive documentation (or I did not find this). Beyond that, for my pipeline I need to know how do I rewrite the following HTTP call in the modules of this library: f"/users/{user_principal_name}/drive/root:/{FolderName}:/children".

Thanks in advance for any response.

atdiausx2 avatar Dec 10 '23 19:12 atdiausx2

I had the same problem as you. If we look at the following example in the API docs:

graph_client = GraphServiceClient(credentials, scopes)


request_configuration = DeltaRequestBuilder.DeltaRequestBuilderGetRequestConfiguration()
request_configuration.headers.add("Prefer", "odata.maxpagesize=2")


result = await graph_client.me.mail_folders.by_mail_folder_id('mailFolder-id').messages.delta.get(request_configuration = request_configuration)

For me changing this to the following works:

graph_client = GraphServiceClient(credentials, scopes)


request_configuration = graph_client.me.mail_folders.delta.DeltaRequestBuilderGetRequestConfiguration()
request_configuration.headers.add("Prefer", "odata.maxpagesize=2")


result = await graph_client.me.mail_folders.by_mail_folder_id('mailFolder-id').messages.delta.get(request_configuration = request_configuration)

roman1900 avatar Dec 14 '23 00:12 roman1900

Thanks for the specific case. The biggest problem in my case (what prevents me on elaborating on your case) is that my access is permissionless, so if I get it correctly I cannot use just me.

Btw, my particular case was resolved by constructing a request via link with msgraph-core ÷÷÷

atdiausx2 avatar Dec 22 '23 23:12 atdiausx2