Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Run script on multiple folders based on value of metadata column

$
0
0

Hi all,

Sorry if this is the wrong forum, if so please let me know where to post.

I'm (slowly) learning to code and trying to use it to customize Sharepoint 2013.

We already have a good script that creates subfolders and gives them unique permissions onclick.

The problem is, you have to type the full name of the folder into the input then click the button. Our names are long and include dates, and I want to run this code automatically on all new folders.

Here is part of our code:

workerFolderName='Documents/'+$('.folder').val();
//createFolder(_spPageContextInfo.webAbsoluteUrl,'Documents/2015/sub')
foldername=workerFolderName;

createFolder(_spPageContextInfo.webAbsoluteUrl,workerFolderName)
.done(function(data)
{
   var folder = data.d;
foldername=workerFolderName;
   console.log('Folder ' + folder.Name  + ' has been created successfully');

and then the input and buttons:

FieldWorker Name : <input type='text' class='folder'/>
<input type='button' onclick='create();' value='Create Folder And SubFolders'/>
<input type='button' onclick='setSubFoldersPermission();' value='Set Permission'/>

I want to have this code run on all new folders, without having to input the title of the folder. I was thinking of creating a workflow on all new items that adds a value to a metadata column, then if there was a way to run this code on all list items with that value in the column, and then to clear the value from that metadata column.

Does that sounds even doable?

If so, does anyone know the right script for the if statement?

Someone mentioned it may be doable with Visual Studio?

Thankful for any insight!

Sylvie


Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>