Skip to content

Instantly share code, notes, and snippets.

@nuriozbey
Last active September 9, 2022 13:58
Show Gist options
  • Select an option

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

Select an option

Save nuriozbey/c695474f0593392399d559be95377f37 to your computer and use it in GitHub Desktop.
"""
Usage:
old_file_dir = '/teams/<channel>/Shared Documents/General/DummyFolder/dummy2.txt'
new_file_dir = '/teams/<channel>/Shared Documents/General/dummy_3.txt'
move_file(ctx=ctx, old_file_dir=old_file_dir, new_file_dir=new_file_dir)
"""
def move_file(ctx, old_file_dir, new_file_dir):
source_file = ctx.web.get_file_by_server_relative_url(old_file_dir)
source_file.moveto(new_relative_url=new_file_dir, flag=1)
ctx.execute_query()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment