eran
eran

Reputation: 6921

access reference attachment content using outlook REST API

I'm using outlook rest api to scan email and access all its attachments. For attachments which are copied this works ok. But if the attachment is uploaded to one drive and sent as link, then I did not find a way to access its content.

using the //attachments endpoint, I get the folloing data for this attachment:

 {'@odata.id': "....",
 '@odata.type': '#Microsoft.OutlookServices.ReferenceAttachment',
 'ContentType': 'text/plain',
 'Id': '....',
 'IsInline': True,
 'LastModifiedDateTime': '2017-12-14T13:07:47Z',
 'Name': 'ccc.txt',
 'Size': 418}

Is there anyway to access the attachment content in this case? Thanks.

Upvotes: 0

Views: 227

Answers (1)

Jason Johnston
Jason Johnston

Reputation: 17702

The properties you need are only available on the /beta endpoint (I'm guessing you're using /v2.0?)

The SourceUrl property contains the URL to access the attachment.

GET /api/beta/me/messages/{message-id}/attachments

{
    "Id": "AAMkADBlNmQ2MTFl...",
    "LastModifiedDateTime": "2017-12-14T16:21:02Z",
    "Name": "Document1.docx",
    "ContentType": null,
    "Size": 13955,
    "IsInline": false,
    "SourceUrl": "https://1drv.ms/w/s!AuZOv...",
    "ProviderType": "OneDriveConsumer",
    "ThumbnailUrl": "",
    "PreviewUrl": "",
    "Permission": "Other",
    "IsFolder": false
}

Upvotes: 0

Related Questions