Skip to content

Instantly share code, notes, and snippets.

@nuriozbey
Created September 6, 2022 11:50
Show Gist options
  • Select an option

  • Save nuriozbey/22d1a0ae7a76cb76457467f9cb99ae50 to your computer and use it in GitHub Desktop.

Select an option

Save nuriozbey/22d1a0ae7a76cb76457467f9cb99ae50 to your computer and use it in GitHub Desktop.
"""
# Usage:
file_relative_url = '/teams/DataShare/Shared Documents/General/DummyFolder/dummy.txt'
delete_file(ctx = ctx , file_relative_url = file_relative_url)
"""
def delete_file(ctx, file_relative_url):
file_to_delete = ctx.web.get_file_by_server_relative_url(file_relative_url)
file_to_delete.delete_object()
ctx.execute_query()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment