1

I made a call like https://graph.microsoft.com/beta/sites/4development106.sharepoint.com:/sites/DBSchenker:/lists/OEC_Docs?select=id,name,lastModifiedDateTime&expand=items(expand=fields(select=Title,Attachments))

and the response came as

  {
    "@odata.context": "https://graph.microsoft.com/beta/$metadata#Collection(microsoft.graph.list)(id,name,lastModifiedDateTime,items(fields(Title,Attachments)))/$entity",
    "@odata.etag": "\"a2b82575-6781-4c1e-9376-0cb9865a5f12,1\"",
    "id": "a2b82575-6781-4c1e-9376-0cb9865a5f12",
    "lastModifiedDateTime": "2018-10-30T01:04:25Z",
    "name": "OEC_Docs",
    "[email protected]": "https://graph.microsoft.com/beta/$metadata#Collection(microsoft.graph.list)('a2b82575-6781-4c1e-9376-0cb9865a5f12')/items(fields(Title,Attachments))",
    "items": [
        {
            "@odata.etag": "\"02115e22-f23a-4259-8ed6-daf8c43281ac,2\"",
            "createdDateTime": "2018-10-30T01:04:25Z",
            "eTag": "\"02115e22-f23a-4259-8ed6-daf8c43281ac,2\"",
            "id": "1",
            "lastModifiedDateTime": "2018-10-30T01:04:25Z",
            "webUrl": "https://4development106.sharepoint.com/sites/DBSchenker/Lists/OEC_Docs/1_.000",
            "createdBy": {
                "user": {
                    "email": "[email protected]",
                    "id": "7e2e677e-9869-42a7-af35-7b9f2a64438a",
                    "displayName": "Vik Kumar"
                }
            },
            "lastModifiedBy": {
                "user": {
                    "email": "[email protected]",
                    "id": "7e2e677e-9869-42a7-af35-7b9f2a64438a",
                    "displayName": "Vik Kumar"
                }
            },
            "parentReference": {
                "siteId": "4development106.sharepoint.com,c0dcbfd8-d394-4b66-9292-d98b8d05be42,79ff79ae-9fc1-44e2-84f6-405f835b60cf"
            },
            "contentType": {
                "id": "0x010046F955EDF3E8184B9934ABF6AE97CF33",
                "name": "Item"
            },
            "[email protected]": "https://graph.microsoft.com/beta/$metadata#Collection(microsoft.graph.list)('a2b82575-6781-4c1e-9376-0cb9865a5f12')/items('1')/fields(Title,Attachments)/$entity",
            "fields": {
                "@odata.etag": "\"02115e22-f23a-4259-8ed6-daf8c43281ac,2\"",
                "Title": "Test Attachment",
                "Attachments": true
            }
        }
    ]
}

i can get title here but how do i get the link to the actual attachment? attachments field just indicate if there is one associated but not the actual one.

2
  • 1
    Note: There are some personal information such as account and site address in your post. It is a public forum. In order to avoid information leakage, I suggest remove the personal information. Or, you can use some characters such as <account>@<tenant>.onmicrosoft.com and <tenant>.sharepoint.com instead. Commented Oct 31, 2018 at 7:50
  • I am having the same problem. Everything works fine with microsoft graph, but can't get the attachment files from a sharepoint item. I have tried the work around, but the request to Sharepoint Rest API returns a Not Authorized. I am using a token from Azure Active Directory (AAD) retrived using Microsoft Identity Client library. Do you have any idea why is not working? Kind regards Sergio Commented Feb 7, 2019 at 8:07

1 Answer 1

0

Per my research, it seems that currently the Microsoft Graph API does not support retrieving attachments from SharePoint list items.

As a workaround, you can retrieve the attachment from items using REST API.

To retrieve all of the files that are attached to a list item:

/_api/web/lists/getbytitle('list title')/items(item id)/AttachmentFiles/

Working with files attached to list items by using REST:

http://msdn.microsoft.com/en-us/library/office/dn292553.aspx#FileAttachments

2
  • thanks let me check.. this whole thing is a bit of mess so far.
    – Vik
    Commented Oct 31, 2018 at 23:47
  • 1
    the above one get me hit into another issue as sharepoint.stackexchange.com/questions/252017/… MS apis seems to be a complete mess.
    – Vik
    Commented Nov 2, 2018 at 17:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.