Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BatchRequestItem use absolute url path instead of relative when, causing "Ressource not found" 400 error #1015

Open
pi-infected opened this issue Dec 9, 2024 · 0 comments
Labels
status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience

Comments

@pi-infected
Copy link

pi-infected commented Dec 9, 2024

Describe the bug

Here is my code :

batch_requests = BatchRequestContent()
for message_id in message_ids:
  query_params = MessagesRequestBuilder.MessagesRequestBuilderGetQueryParameters(
      select=[
        'id',
        'conversationId',
        'internetMessageId',
        'subject',
        'body',
        'bodyPreview',
        'from',
        'toRecipients',
        'ccRecipients',
        'bccRecipients',
        'receivedDateTime',
        'sentDateTime',
        'internetMessageHeaders',
        'isRead',
        'isDraft',
        'importance',
        'hasAttachments',
        'categories',
      ]
    )
    request_configuration = RequestConfiguration(
      query_parameters=query_params
    )
    request = service.me.messages.by_message_id(message_id).to_get_request_information(
      request_configuration=request_configuration
    )
    request_id = str(uuid.uuid4())
    batch_request_item = BatchRequestItem(id=request_id, request_information=request)
    #   batch_request_item.url = batch_request_item.url.replace('https://graph.microsoft.com/v1.0', '')
    batch_requests.add_request(request_id=request_id, request=batch_request_item)

Without the line I've commented, it causes a 400 "Resource not found for the segment 'https:'".
I figured out the problem by looking at your code.

I guess it is not the behavior as you intended.

Expected behavior

The server answer a code HTTP 200

How to reproduce

1 - List message ids from Outlook
2 - Try to get the email content in batch

SDK Version

No response

Latest version known to work for scenario above?

No response

Known Workarounds

No response

Debug output

Click to expand log ```
</details>


### Configuration

_No response_

### Other information

_No response_
@pi-infected pi-infected added status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience labels Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience
Projects
None yet
Development

No branches or pull requests

1 participant