1

I’ve just built my first webhook which I’m using to make SharePoint Online take the changed files from one library and synchronise them across a set of libraries in the site collection’s subsites.

For adding of files, updating and deleting I’ve got it working fine but the one scenario I’m struggling to work with is renaming.

Because the webhook runs after the user changes the file name I’ve no way of then taking the name and updating the sub site copies. Instead SharePoint is treating the file as being new, copying it across and then leaving me with an orphaned file of the original.

Does anyone know if there is any other file property that could be used for cross reference on the other files? Like list internal names.

The only ways I can think to do this is through a look up on the version history, by storing the file name in another column and using that or by handling the renaming through a remote event receiver instead. The first two seem a bit hacky and would need extra coding just to handle those. Migrating to a RER just for this or having a RER just for renaming seems a fragmented solution as well.

  • You can use the ID of the original item; that won't change on a rename. But unless you explicitly store it, the name of the file is lost upon rename. – Trevor Seward May 29 '18 at 0:37
  • Thanks Trevor but unfortunately the IDs of the original library don’t match to that of the subsites. – James Buckingham May 29 '18 at 4:54
  • Just had a thought from your comment Trevor and that is I could pass through the ID of the original file using an extra column. That would probably simplify my current deletion approach as well which I'm doing at the moment through a comparison of the start token date against the deleted date from the recycle bin. Thanks again – James Buckingham May 29 '18 at 7:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.