1

We work with an Doc Library which receives the files via E-Mail. This works great, but now we want to change the filename via workflow. The problem in this situation is that the workflow doesn't start automatically when you are sending the files via Email. So we have to start the workflow manually. Is there a way to add a javascript which updates the files, so that the workflow starts automatically?

1

Why exactly javascript? It doesn't fire automatically too, when a new e-mail will receive. To answer on your question, you can try update files by the code from How to: Create, Update, and Delete List Items Using JavaScript. To retrieve items by query try How to: Retrieve List Items Using JavaScript.

First of all and most properly, you can create List Event receiver and realise you own rename logic in ItemAdding method.

SharePoint jobs can help with running workflows programmatically but as was mentioned before to prevent running code on processed files you should add to the library some hidden column and fill it.

The last one, PowerShell could help to run workflows automatically, but it shoul be run from the server side, for example Task Scheduler, and still you have to exclude processed files from query.

  • Javascript was just an idea. I'm thankful for every other hint you can give me. But it is not possible to use Powershell, because i'm just Sharepoint online admin and our company has no visual studio which i can use. For this reason i work as far as can with javascript. – Tiac Jan 13 '14 at 12:01
  • I added some links to the first paragraph. If you already tried them give please an answer what was wrong. – Michael Jan 13 '14 at 12:17
  • I worked with the update link from your first paragraph. Thanks for that. It works fine for one list item because i got the listiem by Id. Now i have to change the code to update the whole list. This could be a while – Tiac Jan 15 '14 at 8:56
0

How about creating a site workflow which loops through each file in your library? If you add a hidden column you can set a flag when the workflow has actioned a file so it is ignored the next time.

  • Sorry, but i have no idea how to loops a site workflow through each file of my library. I just work with site workflow which has to be started manually. – Tiac Jan 13 '14 at 9:47
  • Ah sorry - most of my workflows are done in Nintex and that allows scheduling of site workflows. It does not look like there is an option to do this using SPD workflows. – Dave Paylor Jan 13 '14 at 11:39

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.