Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Connector Development
Answered

DELETE Method in Send an HTTP request to SharePoint connector in flow

Like (1) ShareShare
ReportReport
Posted on 24 Oct 2024 05:15:33 by 25
Hi recently I was watching an interesting YouTube video by Reza Dorrani on how to 'Build a CHAT experience in Power Apps using SharePoint Lists' - https://www.youtube.com/watch?v=u7uLgJS-NUs. I have created a similar workflow where I am able to get comments added to a list item as well as post a comment from power apps using the 'GET' & 'POST' method in Send an HTTP request to SharePoint connector in flow. Additionally I wondered if I could also add additional features such as delete or edit a comment (which is existing in SharePoint) to a list item from power apps. So to achieve this I added an Or branch to my flow which checks if the input is equal to Delete (set in the power apps V2 connector inputs), if yes then using a similar approach as in 'GET' & 'POST' method in Send an HTTP request to SharePoint connector I am asking the flow to delete comment using the 'DELETE' method. I am calling my flow on the 'OnSelect' of  a trash icon inside my gallery control set to:
Set(varComments, CustomerRequestsComments.Run("Delete",Table1.Selected.ID).response) where 'varComments' is the variable that holds metadata JSON structure, 'Table1.Selected.ID' shows item ID. But its gives me an 502 error: The type Microsoft.SharePoint.Comments.CommentEntitySet does not support HTTP DELETE method and the flow fails.
In my flow:
'Send an HTTP request to SharePoint 2' action Raw inputs:
{
    "host": {
        "connectionReferenceName": "shared_sharepointonline",
        "operationId": "HttpRequest"
    },
    "parameters": {
        "dataset": "https://SPList name",
        "parameters/method": "DELETE",
        "parameters/uri": "_api/web/lists/getbytitle('CustomerRequests')/items(27)/Comments"
    }
}
 
Raw Outputs:
{
    "statusCode": 400,
    "headers": {
        "Cache-Control": "no-store, no-cache",
        "Pragma": "no-cache",
        "Set-Cookie": "ARRAffinity=1a7aff82bc21373b03d8fda86d009014a254fb43661cd4068b45b28f7aa56160;Path=/;HttpOnly;Secure;Domain=sharepointonline-cus.azconn-cus-001.p.azurewebsites.net,ARRAffinitySameSite=1a7aff82bc21373b03d8fda86d009014a254fb43661cd4068b45b28f7aa56160;Path=/;HttpOnly;SameSite=None;Secure;Domain=sharepointonline-cus.azconn-cus-001.p.azurewebsites.net",
        "Strict-Transport-Security": "max-age=31536000; includeSubDomains",
        "x-ms-request-id": "89ef5ca1-7007-6000-b8c5-c82673e05f24",
        "X-Content-Type-Options": "nosniff",
        "X-Frame-Options": "DENY",
        "x-ms-tenant-id": "8f3e36ea-8039-4b40-81a7-7dc0599e8645",
        "Timing-Allow-Origin": "*",
        "x-ms-apihub-cached-response": "true",
        "x-ms-apihub-obo": "false",
        "Date": "Thu, 24 Oct 2024 04:32:00 GMT",
        "Content-Length": "479",
        "Content-Type": "application/json",
        "Expires": "-1"
    },
    "body": {
        "status": 400,
        "message": "The type Microsoft.SharePoint.Comments.CommentEntitySet does not support HTTP DELETE method.\r\nclientRequestId: 3407568d-279c-49d5-8519-bd25a7082dbe\r\nserviceRequestId: 89ef5ca1-7007-6000-b8c5-c82673e05f24",
        "source": "https://SPList name/_api/web/lists/getbytitle('CustomerRequests')/items(27)/Comments",
        "errors": [
            "-1",
            "Microsoft.SharePoint.Client.InvalidClientQueryException"
        ]
    }
}
 
More details:

In my power app there is a Form Screen its 'OnVisible' is set to:
Set(varComments, CustomerRequestsComments.Run("Get", Table1.Selected.ID).response)
 
Form Screen has a gallery control whose 'Items' property is set to:
Table(ParseJSON(varComments))
 
Inside gallery control there is a HTML text control whose 'HTMLText' property is set to:
ThisItem.Value.text
 
and using 'OnSelect' of button control I am posting the comment which is set to:
Set(varComments,CustomerRequestsComments.Run("Post",Table1.Selected.ID,{text_1:txtComment.Value}).response);Reset(txtComment);


I am stuck and any help to rectify this error would be much appreciated. I have attached my flow structure for reference.
  • Suggested answer
    DGDGDGFHF Profile Picture
    25 on 28 Oct 2024 at 10:23:50
    DELETE Method in Send an HTTP request to SharePoint connector in flow
    Finally got the DELETE method to function perfectly. To delete a specific comment we need to provide a commentID input parameter type number(make it optional) in the api after Comments(commentID) similar to what we do to get ItemID. And to get commentID value associated with each comment dynamically I added a text label in the gallery with Text property set to: This item.Value.id. Where 'id' denotes the comment id which we can see in the output JSON. FInally I added a Trash icon in my gallery and set its 'OnSelect' property to: Set(varComments,Flowname.run("Delete",Table1.Selected.ID, {num_2:txtlabel.Text}). response). Similarly I added an edit icon to edit each comment using the PATCH method.
  • DGDGDGFHF Profile Picture
    25 on 25 Oct 2024 at 03:09:52
    DELETE Method in Send an HTTP request to SharePoint connector in flow
    If I hardcode the comment ID I am able to delete the particular comment from the list item. But when I try to add it as a dynamic field by adding a input type number parameter (CommentID) in the power apps V2 connector and used it in the Uri field as you have mentioned I am still getting the same error code 502. "The type Microsoft.SharePoint.Comments.CommentEntitySet does not support HTTP DELETE method". Also if I change it to text input parameter (make it optional) this time I get the following error "Unable to process template language expressions in action 'Send_an_HTTP_request_to_SharePoint_3' inputs at line '0' and column '0': 'The template language expression 'triggerBody()['text_2']' cannot be evaluated because property 'text_2' doesn't exist, available properties are 'text, number'".
  • DGDGDGFHF Profile Picture
    25 on 24 Oct 2024 at 10:41:08
    DELETE Method in Send an HTTP request to SharePoint connector in flow
    @Jalpa Mahesh Dhola
    I have tried to add a input type number parameter (CommentID) in the power apps V2 connector and used it in the Uri field as you have mentioned but i am still getting the same error code 502. Should I create a new flow for 'DELETE' method
    https://<tenant>.sharepoint.com/sites/<site>/_api/web/lists/getbytitle('<list-name>')/items(<item-id>)/Comments(<comment-id>)
     
  • Suggested answer
    Jalpa Mahesh Dhola Profile Picture
    35 on 24 Oct 2024 at 08:16:31
    DELETE Method in Send an HTTP request to SharePoint connector in flow
    https://<tenant>.sharepoint.com/sites/<site>/_api/web/lists/getbytitle('<list-name>')/items(<item-id>)/Comments(<comment-id>)
     
    You will have pass the comment-ID. You can not delete all the comments together at once.
  • Suggested answer
    Jalpa Mahesh Dhola Profile Picture
    35 on 24 Oct 2024 at 06:46:38
    DELETE Method in Send an HTTP request to SharePoint connector in flow
    DELETE Method in Send an HTTP request to SharePoint connector in flow
     
    _api/web/lists/getbytitle('CustomerRequests')/items(27)/Comments
     
    @
    I think, List name is not proper in this API.
    When you use getbyTitle in API, we have to pass SharePoint List Display name only. Have you changed the display name? 
    Please check in the SharePoint site where you created a list.
     
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Apps - Connector Development

Overall leaderboard

Featured topics