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
{{ message }}
Repository navigation
DriveItem copy.post() returns DriveItem instead of progress URL #1628
Returns the progress URL instead of the DriveItem / None
How to reproduce
body = CopyPostRequestBody(
parent_reference = ItemReference(
path = "new/path",
),
)
result = await graph_client.drives.by_drive_id(drive_id).items.by_drive_item_id(item_id).copy.post(body)
pprint(result)
Other information
This is apparently due to a bug somewhere in the graph definitions, see the DotNet bug report for more details (microsoftgraph/msgraph-sdk-dotnet#2240).
While we wait for this to be fixed (3 years at least and no progress yet!), could you please document here a workaround so googling at least returns something helpful in Python?
OK, after much trawling of the internet, i figured out how to use the NativeResponseHeader solution from the DotNet report to get the HTTPX response object and use the returned location header from that.
from kiota_abstractions.base_request_configuration import RequestConfiguration
from kiota_abstractions.native_response_handler import NativeResponseHandler
from kiota_http.middleware.options import ResponseHandlerOption
body = CopyPostRequestBody(
parent_reference = ItemReference(
path = "new/path",
),
)
rc = RequestConfiguration(options=[ResponseHandlerOption(NativeResponseHandler())])
result = await graph_client.drives.by_drive_id(drive_id).items.by_drive_item_id(item_id).copy.post(body, request_configuration=rc)
location = result.headers['location']
Activity
jlayt commentedon Nov 20, 2026
OK, after much trawling of the internet, i figured out how to use the NativeResponseHeader solution from the DotNet report to get the HTTPX response object and use the returned location header from that.