How to create runtime folder with today's date in SharePoint

Hi ,i am handling one sharepoint automation where i need to create runtime folder with todays date .

as shown in the screenshot , this is the path where i need to create the folder.

in the second screenshot , shown how i m doing but its not working …i did like we used create folder in normal path .

After your exact location give backslash and your date variable (your date should not contain backslash(/), if date contains slash, it will crate another folder. so please avoid slash and give any other symbols). it will create date folders.

Add this to your path with a slash, that should do it.
DateTime.Now.ToString(“ddMMyy”)
or
DateTime.Now.ToShortDateString

That I already tried …but it’s not creating folder in SharePoint…same method I tried for normal desktop path there folder created

My query is this only in SharePoint this concept is not working


plz check the screenshot , but this concept is not working in sharepoint

@Neha_Aggarwal1

Please try this

Path ecosts will not work with sharpeoint

Cheers



could u plz check where i did wrong because solution is not working, its throwing bad request error on create folder activity

@Neha_Aggarwal1

First of all path exists will not work on sp folders

Follow these steps

  1. Use find files or folder activity nad give query for todays folder Now.ToString("MMddyyyy") and sub folder will be the folder till where it is to be created say till sucess in your case and assign output to results variable say results
  2. Now use if condition with results.Count>0
  3. On then side the folder is already created
  4. On else side it is not created so use find files or folders activity again but now query will be success and sub folder will be till the folder containing success
  5. After find files use create folder(this should be the office 365 activity) and give folder name as Now.ToString("MMddyyyy") and in folder location driveitem give the output of find files /folder results(0)

Cheers

in the 4th point i did not understand query success…what exactly i have to write in that

and in the 5th point …which results(0) is this that comes from second file folder activity which is in else part?

@Neha_Aggarwal1

  1. Success is the folder in which you need to create your final date folder so query shpuld be success and subfolder shpuld be till Archive
  2. Yes this is the results of the find files in the else side

Cheers


i m getting error on the create folder activity …index was outside the bond of array

@Neha_Aggarwal1

Query should be "Success"

And sub folder should be the remaining value before success thats is "Dev/…./Archive"

Cheers

@Anil_G thanks for ur help,it worked

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.