1

I am looking for a powershell or may be flow approach to convert certain words used in Sharepoint file name to upper case. For example,a document library contains about 200 files. Each of these files may or may not contain words like Ln, Plc, Az etc.

The goal is to see if these words are present in the file name first and if so then convert them to upper case. So that way it can be converted into LN, PLC and AZ. This is something I want to perform on all existing files that reside in sharepoint online doc library. So looking for either powershell or flow approach to make it to work, or any other way if possible to do so.

This is a different question, its not a duplicate question. The requirement is different in this case, please read my question description. The question I had asked here was for the whole file name: upper/lower case naming convention for Document name in SPO Doc Lib. I am using this solution currently. But now i need another script or flow to catch certain words in the file name across the document library and only make them turn into upper case. thanks in advance.

2

use this flow i created few days ago, but in one thing, change to function:

CHANGES:

after some chat here is solution with dictionary for upper case words:

  1. Create Custom List in SPO, only with Title. Fill Title with words you want to keep uppercase:

enter image description here

  1. Initialize another variable UpperCaseCol at the start of the Flow which I referred here: enter image description here
  2. Get items from this List with SharePoint Get Items function: enter image description here
  3. Create Apply to Each before the existing one
    • Output from previous step: Get items - value
    • Set Variable: Working with Get items - Title
    • Append to string - Name: UpperCaseCol, Value: concat(toUpper(variables('Working')),',')

enter image description here

  1. Edit Apply to each - existing from the referred flow, edit the body
    • Insert Condition after setting variable Working, condition will be variable(UpperCaseCol) contains toUpper(variables('Working'))
    • YES: create new Append to string variable - Name: CorrectName, Value: concat(' ',toUpper(variables('Working')))
    • NO: moved existed Append action

enter image description here

Thats everything, Flow will looks like: enter image description here

Document names changed:

from: enter image description here

to (Ar was not in the UpperCase list, its OK): enter image description here

CHANGES PATH TWO - FIXING LAST WORDS AND '-' before them:

  1. Move Initialize variable - Working as first Initializing (you will need it) and fill value with: replace(triggerBody()?['{Name}'],'-',' - ') - this will create always '-' with a spaces from both sides (it's the easiest way)
  2. Change Initialize variable NAME - value: split(variables('Working'),' ')
  3. Thats everything, it will looks like:

BEFORE: enter image description here

AFTER: enter image description here

  • Thanks Zdenek. I am only looking this to be applicable for certain words in file name. For example, let' s say a file name is: "Monthly Cfo Report Mm Az 1-29-19" then it should be set to Monthly CFO Report MM AZ 1-29-19. Will the above formula account for this change, thanks for the help again. – mdevm Jan 30 at 20:29
  • So words Monthly and Report in file name should not be converted to MONTHLY and REPORT post running the flow. – mdevm Jan 30 at 20:30
  • okey, but how you recognize that the CFO or MM is short of something? You probably need some keywords saved somewhere and working with them, after this you need to update this Append to string function. – Zdeněk Vinduška Jan 30 at 20:42
  • Hi Zednek, I received feedback today from the end client and they want to make sure that certain words in file name should not be in upper/lower rather only Upper case. Cfo, Mm are only examples I am giving. – mdevm Jan 30 at 20:59
  • ok understand, so they want words shorted than 3 symbols to make upperCase only? – Zdeněk Vinduška Jan 30 at 21:01

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.