New Folder

Interested in talking about Mash-up's? This is the place.
Post Reply
jfavero
Posts: 31
Joined: Fri Sep 12, 2014 10:24 pm

New Folder

Post by jfavero »

I want to add another Top Level Folder like "Inbox" to the folders section. I want to call this folder "My Folder" and then be able to add sub folders underneath it to match a directory structure of a Document Management system. Is there sample code to show how to create a new top level folder and add sub folders to it??
Thanx Joe
14319KevinH
Ambassador
Ambassador
Posts: 4558
Joined: Fri Sep 12, 2014 9:52 pm

New Folder

Post by 14319KevinH »

There is no way via a Zimlet today to add a new System Folder. You'd have to make a core code change.... In general most folks add a zimlet that launches a new dialog that has the tree structure in there.
jfavero
Posts: 31
Joined: Fri Sep 12, 2014 10:24 pm

New Folder

Post by jfavero »

Kevin
I the init method of the Zimlet, I have been able to call this to

create a new Folder:
// Create Folder

soapDoc = AjxSoapDoc.create("CreateFolderRequest", "urn:zimbraMail");

var folderNode = soapDoc.set("folder");

folderNode.setAttribute("name", "Xythos");

folderNode.setAttribute("l", top.id);

folderNode.setAttribute("view", ZmOrganizer.VIEWS[ZmOrganizer.FOLDER]);

command = new ZmCsfeCommand();

var resp = command.invoke({soapDoc: soapDoc});

var id = resp.Body.CreateFolderResponse.folder[0].id;


However I am now trying to have my Zimlet called if a conversation is dropped into this folder. Is there a way to assign a listener to this??
Thanx Joe
JoshuaPrismon
Outstanding Member
Outstanding Member
Posts: 458
Joined: Fri Sep 12, 2014 9:59 pm

New Folder

Post by JoshuaPrismon »

[quote user="jfavero"]Kevin
I the init method of the Zimlet, I have been able to call this to

create a new Folder:
// Create Folder

soapDoc = AjxSoapDoc.create("CreateFolderRequest", "urn:zimbraMail");

var folderNode = soapDoc.set("folder");

folderNode.setAttribute("name", "Xythos");

folderNode.setAttribute("l", top.id);

folderNode.setAttribute("view", ZmOrganizer.VIEWS[ZmOrganizer.FOLDER]);

command = new ZmCsfeCommand();

var resp = command.invoke({soapDoc: soapDoc});

var id = resp.Body.CreateFolderResponse.folder[0].id;


However I am now trying to have my Zimlet called if a conversation is dropped into this folder. Is there a way to assign a listener to this??
Thanx Joe[/QUOTE]
Part of the problem here is that folder content can come from other places then just the Zimbra web front end. You might be able to attach to the organizer to find out what's going on, but that won't help at all for other behavior.
It would be nice to have a way to attach behavior to a particular folder, but I don't know of one.
14319KevinH
Ambassador
Ambassador
Posts: 4558
Joined: Fri Sep 12, 2014 9:52 pm

New Folder

Post by 14319KevinH »

Joe - That will create the folder (and btw may fail or error on the 2nd login) so in that case you need a listfolder request to get the ID.
One idea would be to hook into the global notifications for the mailbox and then look for messages that match the folder you've created. It just doesn't seem very efficient to do it this way. If your trying to sync it may be better to write a client that interacts with the sync API and provide a way for the user to sync on-demand.
Post Reply