Share via

Microsoft Graph API for getting list items is not returning the right item specific webUrl

Harshita V 31 Reputation points
2022-07-11T10:44:43.17+00:00

I am using this url to get the list items "https://graph.microsoft.com/v1.0/sites/<site_id>/lists/<list_id>/items?expand=fields" . The response is being returned fine, I need to access the "webUrl" property of the returned list item so the user can go to that record in SharePoint list from my app. However the "webUrl" returned is not pointing to a web page and is just downloading a weird file with the extension .000

Example list item:
{
"@odata.etag": "\"<eTag>,1\"",
"createdDateTime": "<createdDate>",
"eTag": "\"<eTag>,1\"",
"id": "<id>",
"lastModifiedDateTime": "<last_modified>",
"webUrl": "https://mydomain.sharepoint.com/sites/<site_name>/Lists/<list_name>/<id>_.000",
"createdBy": {
"user": {
<user_info>
}
},
"lastModifiedBy": {
<user_info>
},
"parentReference": {
"siteId": "<site_id>"
},
"fields@odata.context": "https://graph.microsoft.com/v1.0/$metadata#sites('<site_id>')/lists('<list_id>')/items('id')/fields/$entity",
"fields": {
"@odata.etag": "\"<eTag>,1\"",
"id": "<id>",
"ContentType": "<content_type>",
"Title": "<title>",
"Modified": "<modified_date>",
"Created": "<created_date>",
"Attachments": false,
"Edit": "",
"LinkTitleNoMenu": "<link title menu>",
"LinkTitle": "<link title>",
"ItemChildCount": "0",
"id_no": <some_Id>,
}
}

The highlighted webUrl above just downloads a file with .000 extension. Please help me understand why this is happening and how to resolve it or is it the expected behavior. As I need the links to the list item. Because as per the doc the "webUrl is a string URL that displays the item in the browser. And is Read-only."

Microsoft Security | Microsoft Graph
0 comments No comments

2 answers

Sort by: Most helpful
  1. Zehui Yao_MSFT 5,881 Reputation points
    2022-07-25T16:30:54.193+00:00

    Hi @Harshita V , you can submit a feature request idea via this support link to suggest tweaks to the document content, which will be monitored by Microsoft team and make the enhancements to Microsoft Graph APIs. I will also upvote for you.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Was this answer helpful?


  2. Srinivasa Rao Darna 6,851 Reputation points Microsoft External Staff
    2022-07-11T13:42:21.527+00:00

    Hi @Harshita V ,

    This is by design of SharePoint list items will have webUrl https://mydomain.sharepoint.com/sites/site_name/lists/list_name/id_.000, webUrl is generated from FileRef of the listitem.

    You may have to generate list item webUrl like this https://mydomain.sharepoint.com/sites/site_name/lists/list_name/dispform.aspx?id={id}.

    FileRef: GET /sites/{site-id}/lists/{list-id}/items?$expand=fields($select=FileRef)

    Hope this helps.

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have further questions about this answer, please click "Comment".

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.