3
votes

I'm following documentation from here https://developer.microsoft.com/en-us/graph/docs/api-reference/beta/resources/sharepoint

I want to enumerate lists from default site.

  1. get siteId using /sharePoint/site end point(works fine)
  2. Request lists using sharePoint/sites/{{siteId}}/lists doesn't work returns 404 with following message

    { "error": { "code": "itemNotFound", "message": "Requested site could not be found", "innerError": { "request-id": "34b1b51a-59ba-4c56-991a-319ffbe33005", "date": "2017-04-07T10:46:40" } } }

any pointers

2

2 Answers

2
votes

in sharePoint/sites/{{siteId}}/lists the part of {siteId} is actually 3 part, the domain, root site id, subsite id, for for example if i have a domain contoso.sharepoint.com, with a site named root site with id 123 (it should be a guid) and another subsite under that named Klingon Site with id of 145 so my final {siteId} is contoso.sharepoint.com,123,145

should be like contoso.sharepoint.com,fffdf23f-1234-1234-a744-17e2e196e777,1481eca1-4567-4567-8dbc-60c666ab3b8c

1
votes

I'm assuming you have confirmed there is a list within this site. You'll get a 404 if you attempt to fetch a list collection from a site without one.

More likely is you're using the wrong ID. The documentation is a bit ambiguous about which property it means by {site-id}.

When you fetch your site, there will be both a siteId and an id property. You want the id property. Using siteId will result in a 404.

{
    "createdDateTime": "",
    "description": "",
    "id": "**** Use this one ****",
    "lastModifiedDateTime": "",
    "name": "",
    "webUrl": "",
    "root": {},
    "siteCollection": {
        "hostname": ""
    },
    "siteCollectionId": "",
    "siteId": "**** Not this one ****"
}