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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Remove an item from a ...
Power Apps
Answered

Remove an item from a SharePoint list with the connector being a variable

(0) ShareShare
ReportReport
Posted on by 75

I have a Model Driven App that needs to be able to be moved from Dev-->Stg-->Prod. As part of this, the solution connects to different SharePoint document libraries at each step. I have an environment variable to dictate what this URL is, and generally this works well. I am struggling, however, with deletion of a document in a Canvas App. I know that I could create a Power Automate to do this, but that seems overly complicated and I am hoping for a simpler solution.

 

Previously, all of the environment changes were handled manually and this was untenable -- it is far too easy to forget to change something in production, thus breaking prod. So, I made a change to add the SharePoint libraries for each of Dev, Stg, and Prod to the Canvas App. Then at the start of the application loading data, I determine which version I am currently working with and set that to a variable named varActiveSharePointConnector. This works perfectly for displaying the data in my gallery. However, I cannot find a way to complete a deletion because every method requires the first argument to be a Collection. When using the actual connector names, the Canvas App would let me use the Connector name as the collection, and essentially do Remove('My Connector', ThisItem);. However, when converted into a variable this does not work.

 

I have looked at Remove, and at Patch to do this, both require a collection as the first argument. I tried also doing a Collect(collActiveSharePoint, varActiveSharePointConnector), but then again, I cannot properly reference the SharePoint document library, only the current collection.

Categories:
I have the same question (0)
  • BCBuizer Profile Picture
    22,577 Super User 2026 Season 1 on at

    Hi @PattersonCA1 ,

     

    Have you looked into using Environment Variables?

     

    https://learn.microsoft.com/en-us/power-apps/maker/data-platform/environmentvariables

  • Rusk Profile Picture
    1,369 Super User 2024 Season 1 on at

    Hi @PattersonCA1 

     

    I also do not know of a way to remove an item using the approach you have in place for environment changes.  Have you considered using Search + Replace to change your data source as needed?

    https://www.matthewdevaney.com/rename-variables-in-power-apps-with-1-click/

     

    I realize this was not the question you were asking but just a thought

  • PattersonCA1 Profile Picture
    75 on at

    I am using Environment Variables in other places (such as the URLs of the SharePoint sites as mentioned in the original question), so I am familiar with them. How are you suggesting to use them here?

  • PattersonCA1 Profile Picture
    75 on at

    This would work for the way I used to do these changes (manually), but still runs the risk of it being forgotten when published to product -- or not getting updated because of a solution layer. I am leaning towards doing this as a Power Automate since it seems like there isn't a great way to do this otherwise.

  • Verified answer
    PattersonCA1 Profile Picture
    75 on at

    I ended up doing this with a Power Automate because I couldn't find a good solution.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 549 Most Valuable Professional

#2
Kalathiya Profile Picture

Kalathiya 225 Super User 2026 Season 1

#3
Haque Profile Picture

Haque 224

Last 30 days Overall leaderboard