Smart folder subfolders dynamically

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Member II

Smart folder subfolders dynamically

Hi,

Is it possible to create smart folder's subfolders dynamically? All examples that I am finding only have fixed virtual folder structure.

I need to create smart folder where all contents are grouped to same virtual folder with same property value. For example the property could be emails sender property (cm:emailed:sender). The smart folder would contain subfolders of all possible email sender properties in contents, and within the content with that sender.

Is this possible, or does it require some more advanced add-on development?

Thanks

1 Reply
Highlighted
Active Member II

Re: Smart folder subfolders dynamically

you can create a web script and apply a rule for the root folder to run that script. I also did something like that. 

Sample web script file 

// create a new folder in the same space
var whatEvent = document.properties["ia:whatEvent"];
var toDate = document.properties["ia:toDate"];
var fromDate = document.properties["ia:fromDate"];
var dd = toDate.getDate();
var mm = toDate.getMonth()+1; //January is 0!
var yyyy = toDate.getFullYear();
if(dd<10){
dd='0'+dd;
}
if(mm<10){
mm='0'+mm;
}
var today = dd + "-" + mm + "-" + yyyy;
var dd = fromDate.getDate();
var mm = fromDate.getMonth()+1; //January is 0!
var yyyy = fromDate.getFullYear();
if(dd<10){
dd='0'+dd;
}
if(mm<10){
mm='0'+mm;
}
var today1 = dd + "-" + mm + "-" + yyyy;
var folderNode = space.createFolder(whatEvent);
folderNode.properties['cm:title'] = today;
folderNode.properties['cm:description'] = "Due Date for Submission: " + today1;
folderNode.save();
// move the folder node to companyhome
var objDestFolder = companyhome.childByNamePath("Shared/Secretary to the Commission/COMMISSION_MEETINGS");
folderNode.move(objDestFolder);