web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / SharePoint Delete docu...
Power Apps
Unanswered

SharePoint Delete document from library request

(0) ShareShare
ReportReport
Posted on by 12

I have a document library where all users delete permissions have been revoked.

 

I want to add a delete button using SharePoint format column feature, this will open up a Power App giving the user the information about the document and a required field with the reason why they want to delete the item. 

 

This will then start a workflow to request deletion of the item by a user that has access to delete.

 

I'm new to Power Apps and all the examples I am seeing relate to lists and not document libraries.

 

This example shows it working on a list https://www.sharepointsiren.com/2019/05/opening-powerapp-using-sharepoint-column-formatting-part-2/

 

Can anyone point me in the right direction?

Categories:
I have the same question (0)
  • v-xida-msft Profile Picture
    on at

    Hi @louiserh ,

    Do you want to delete a SP Library Item using canvas app?

     

    Actually, the SP Library is essentially a List, so the same functionality applied to your SP List could also work for your SP Library.

     

    You could consider add a delete button using SP format column feature in your SP Library, and then put the following JSON formula for formatting your column:

    {
     "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
    
     "elmType": "a",
    
     "txtContent": "@currentField",
    
     "attributes": {
     "target": "_blank",
     "href": "='PutURLOfYourCanvasAppHere?ID='+[$ID]"
     }
    }

     

    Then within your canvas app, set the OnStart property of App to following:

    Set(ItemID, Param("ID"));
    If(
     !IsBlank(ItemID),
     Navigate(EditScreen1)
    )

    Within the Edit Screen, set the Item property of the Edit form to following:

    If(
     !IsBlank(ItemID),
     LookUp('Your SP Library', ID = Value(ItemID)),
     BrowseGallery1.Selected
    )

    Note: I assume that you have generated a canvas app based on your SP Library already.

     

    Please try above solution, then check if the issue is solved. And I think you are in right direction.

     

    Regards,

  • louiserh Profile Picture
    12 on at

    Thanks for your help.

     

    I'm starting to make more progress. 

     

    If I want the app to open up straight on EditScreen1 so the user can edit straight away, do you know how I could get that to happen? Instead of going to the BrowseGallery1

     

    I'm really new to PowerApps so I created an app from a list and I'm trying to replicate the screens and functionality in the canvas app I created for the document library.

     

    I really only need one Screen and that is edit.

     

    Thanks

     

  • v-xida-msft Profile Picture
    on at

    Hi @louiserh ,

    Regarding the needs that you want to achieve, I think the solution I provided above has achieved your needs already.

    '''

    2.JPG

     '''

     

    Please also check and see if the following thread solution could help in your scenario:

    https://powerusers.microsoft.com/t5/Building-Power-Apps/Editing-a-record-from-a-flow-powerapp/m-p/265416

    https://powerusers.microsoft.com/t5/Building-Power-Apps/Embedded-link-to-a-Sharepoint-List-item-in-PowerApp/m-p/303910

     

    Regards,

  • louiserh Profile Picture
    12 on at

    Almost there, thanks for your help.

     

    I have the app opening now with the data of the selected item but when I select the icon to save, OnSelect is set to SubmitForm(EditForm1) I get an error stating "There was a problem saving your changes. The data source may be invalid."

     

    Have you come across this happening?

     

     

  • v-xida-msft Profile Picture
    on at

    Hi @louiserh ,

    Have the solution I provided above fixed your original issue?

     

    If the solution I provided above could achieve your original issue, please consider go ahead to click "Accept as Solution" to identify this thread as helpful.

     

    Regarding the issue that you mentioned, it seems that this issue is related to your Data source, please consider remove the SP Library connection from your app, then re-create a new connection to it from your app, check if the issue is solved.

     

    Also please make sure the EditForm1 has been connected to your SP Library/SP List data source properly. Please make sure you have enable Required fields in your Edit form and provide proper value for them, and do not enable System fields within the Edit form in your app.

     

    Regards,

     

     

  • louiserh Profile Picture
    12 on at

    It partially resolved the issue in that the item opens with the data provided but I cannot submit the data.

     

    When I add the following formula to EditForm1 it shows the connect to data icon, and I can no longer add or edit the fields in the properties section.

     

    If(!IsBlank(ItemID),LookUp('LR Test', ID = Value(ItemID)),BrowseGallery1.Selected)

     

    louiserh_0-1597888380115.png

     

     

     

  • Verified answer
    v-xida-msft Profile Picture
    on at

    Hi @louiserh ,

    Could you please share a bit more about the 'LR Test' data source? Is it your SP List?

     

    Regarding the screenshot that you mentioned, it seems that your Edit form has not been connected to your SP List correctly. Please make sure the Edit form is connected to your SP List data source rather than a Collection. If the 'LR Test' is a Collection table, the Edit form would not generate proper field data cards automatically based on the Collection.

     

    On your side, please remove the fields data cards in your Edit form, and then make sure the Edit form is connected to your SP List, then enable the field data cards in your Edit form. In addition, please also make sure the Edit form and the BrowseGallery1 are connected to same SP List data source ('LR Test').

    Set the Item property of the Edit form to following:

    If(
     !IsBlank(ItemID),
     LookUp('LR Test', ID = Value(ItemID)),
     BrowseGallery1.Selected
    )

    or

    If(
     !IsBlank(ItemID),
     LookUp('LR Test', ID = Value(ItemID)),
     LookUp('LR Test', ID = BrowseGallery1.Selected.ID)
    )

     

    Regards,

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 711 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 319 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard