2

I am trying to setup a workflow which renames (i.e. updates the 'name' field of) a file after it is created/uploaded.

I've tried changing the 'name' field using 'set field in current item' command but the workflow just fails at that command....

I've read this question about renaming a file using reusable workflow but it doesn't have an answer and didn't seem to be active anymore and I can't seem to comment in that question.

  • I am adding this as a comment because it is just a guess. Try to first Copy Item into the same library and change the name with the "Path" field and then delete the original file the workflow is running on. Let me know if that does the trick. – T0t3sMcG0t3s Oct 17 '15 at 16:29
  • Thanks for the suggestion! tried it, didn't work though T.T. I used 'Copy document in [Current Item] to [Library Name]', and then 'Update item in [Library Name]' to modify the 'Name and Path' field to a local string variable... Worked up to the copy document step, stopped again when I tried to rename the copied item...did I do something wrong here? – user2686465 Oct 19 '15 at 17:35
1

I cannot comment (not enough reputation), but this is my experience with Copying files.

There is a limit of 260 characters for URL which is called for copy documents. The problem is, filename gets listed twice in that, the method called is:

https://base site/subsites/subsites/_vti_bin/ 
  client.svc/web/getfilebyserverrelativeurl('/again subsites/library_name/filename.xls')/
  CopyTo(strNewUrl='/subsites/target_library_name/filename.xls',%20bOverWrite='false')

As you can see, it is very easy to overflow that limit if you copy from subsites and depending on your domain name length and library names. It doesn't help that Microsoft decided to name the method with 27 characters long name.

There is a solution of changing httpRequest maxLength property within the web.config-File. But it changes allowed length for all sites in site collection.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.