Hello @Monica Gerchinhoren , thank you for reaching out. It looks like the permission "AttachmentSession.Write." is not a valid permission and hence not a suitable scope to mention in the request.
Since the Graph API you are using is for attachment, hence the only scopes that would be required here are:
- If accessing attachments in messages: Mail.Read.
- If accessing attachments in events: Calendars.Read.
- If accessing attachments in group posts: Group.Read.All.
https://learn.microsoft.com/en-us/graph/api/attachment-get?view=graph-rest-1.0&tabs=http
Make sure you remove AttachmentSession.Write from your request and just try with Mail.Read or Mail.ReadWrite and that should work.
Hope this helps.
Do let us know if this helps and if there are any more queries around this, please do let us know so that we can help you further. Also, please do not forget to accept the response as an Answer; if the above response helped in answering your query.