microsoftgraph / microsoftgraph/msgraph-sdk-python
BatchRequestItem use absolute url path instead of relative when, causing "Ressource not found" 400 error
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 630
- Forks
- 96
- Ø Merge
- 15 Std. 20 Min.
- Gemergte PRs (30 T.)
- 3
Beschreibung
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_
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne damit, BatchRequestItem und BatchRequestContent.add_request anhand des Python-Beispiels nachzuverfolgen, und untersuche anschließend, wie die Request-URL für Batch-Operationen erstellt wird. Überprüfe das Verhalten anhand der Reproduktion des Outlook-Nachrichten-Batches und bestätige, dass das gesendete Element einen relativen Pfad verwendet und ohne den Workaround HTTP 200 erhält.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- api
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 45/100