Skip to main content
Nintex Community Menu Bar

Re-name .jpg image in SharePoint document library

  • April 29, 2016
  • 7 replies
  • 36 views

Forum|alt.badge.img+5

I would like to build a simple workflow that re-names a .jpg image in a separate SharePoint document library.

I have 10 images in the document library ('1.jpg' - '10.jpg'), and I would like to re-name '1.jpg' to 'live.jpg', and then put in a 'pause for' action for one week, and then do the same to '2.jpg', and so on until I get to '10.jpg'.

I have tried to do this with the 'update document' action, but it keeps causing an error whenever I try to run a workflow.

Any help would be much appreciated!

7 replies

Forum|alt.badge.img+11
  • Nintex Partner
  • April 29, 2016

Hi Shaun,

the "update document" action is only for updating content INSIDE of word documents. What you want to do can be achieved using the "update item" action.

Presuming you are using a site workflow, it could be done like this:

1. Query your images library ("Query list" action) and save all IDs to a collection variable

2. Use a "For each" to loop through all of your IDs and save single ID in new single line of text variable

3. Use "Update item" to update the name of the current file

Complete workflow should now look like this:

Hope this helps. Let us know if you need further assistance.

Regards

Philipp


Forum|alt.badge.img
  • April 29, 2016

Hi Shaun,

you can create a workflow like this :

1.png

(nb. French version of nintex)

the pause action is set to 5 minutes for the demo

defaut values of variables :

NbActual : 1

NbActual-1 : 0

NbTotal : 11 (will be the total amount of pictures in document library)

txtLiveName : live (the name of the picture name)

Loop configuration :

3.png

Update item action :

4.png

The document library is the default one with the 10 pictures named 1 to 10 .jpg

All pictures must have .jpg extension.

iexplore_2016-04-29_17-38-38.png


Forum|alt.badge.img+5

Thanks Philipp! Worked perfectly


Forum|alt.badge.img+3

Hi Phillip,

I have a picture library and I dont want users to override already existing images. That's why I am appending created date to the Name file in a simple workflow. However I am getting error that Name requires different type of information. I have tried both Update Item and Set Field Value. I even tried adding .jpg at the end of the string. Please help.


Forum|alt.badge.img+11
  • Nintex Partner
  • April 30, 2018

Hi Akshay,

you can update the "Name" column but the error occurs as soon as you try to insert a date in the name. I even tried to use the "Calculate date" action and store the date as ISO string but that didn't work either. I think its due to special characters in the timestamp (e. g. the colon) that are not allowed to use in file names.

However if you just need some unique name you can update the file name using the current item id which is - of course - unique for every item in your library.

This works for me:

215100_pastedImage_1.png

If you need some sort of timestamp included in your filename you would have to create a string dpeending on the current date manually. Using the "Build string" action with its inline function "fn-formatDate" should help you.

You do NOT need to set the file extension (e. g. ".jpg") yourself, SharePoint will handle this for you.

Cheers

Philipp


Forum|alt.badge.img+3

Hi Philipp, 

Thank you so ,much for your help. Saved a lot of time. I was able to update the name with date stamp using the format dd_MM_yyyy. 

Cheers


Forum|alt.badge.img+11
  • Nintex Partner
  • May 15, 2018

Hi Akshay,

glad I could help you. Can you please mark my answer as correct so other people can see there was found a solution for your issue.

Thanks!

Philipp