Script for adding Shared Folders

Hello again,

since its quite a task to merge this into a plugin and it would take some time, i cant do that within my worktime. in private i will try to take this time, but it would take weeks for me (did said im new to plugins and integration to webapp).

i will update my git and add a comment that everyone is welcome to create this plugin - think its quite usefull for admins to manage this via clicky color gui :)

coffee_is_life

@Coffee_is_life
sounds great!!!..

I still don’t understand what this “plugin” should do any different than the mdm plugin for WebApp. But that may be just me.

@fbartels the MDM Plugin is not working on my System…it seems this script is working…

@Coffee_is_life
I have only one Problem whit the syntax at the moment…I see all the time when I add a folder the following.

Failed adding folder 'Kalender' for user 'user1' on device 'd1aar1gxxxxxxxxxxxs'. ASDevice->AddAdditionalFolder(): folder can not be added because there is already a folder with the same name synchronized in the same parent: 'Kalender'.

so my syntax was

bash add_shared_folder.sh "add" "user1" "Kalender" "user2" "calendar"

so user1 is the receiver the person who will receive this new calendar on his system…right?
user2 is the sender who shares the calendar.

It’s clear on the user1 system is also a Folder whit the Name Kalender and it can not be addet.

In case I use this

bash add_shared_folder.sh "add" "user1" "Kalender - user2" "user2" "calendar"

i got this error

USER, FOLDERNAME, STORE, TYPE and FOLDERID are required for addshared command.

I was listing the folder through z-push admin but can’t figure out the syntax…sorry…
Or maybe the “Kalender” should get a different name on the device who receives the folder.

Think this something to observe.

I createt a different caldenar Treter

bash add_shared_folder.sh "add" "user1" "Treter" "user2" "calendar"

Than the skript shows me 2 calendars first Kalender and Treter, than the skript asks me to add folder id and after the rest of the process the folder is add.

In which file the configuration will be written?
Sorry for asking you…

Hello @theodorm,

there is no config written. its simply getting the folderids from user 2 with type “calendar” and list them.
if there is only one result it will use this (for calendar normally 1 result) and use this folderid to snip the original command from
z-push-admin

i advise to edit the script in the first sector “VARS” and change

debug=false

to

debug=true

it will print all results to the logfile (which can be edit in this section aswell)
and post the log if you cant figure out the bug yourself.
the command to add the store will be logged aswell and you can check it against “z-push-admin --help” syntax for adding the store

coffee_is_life

@Coffee_is_life
Hi…
thanks again…this really works great after I was able to understand how it works.
Don’t know why this mdm Plugin is not working but this works out of the box…thank you so much.
Will be great to have a working Plugin solution…

How firm are you whit kopano?

Best Theo

Pleas note if you wand name your Kalender Kalender User1 then it's not working if there are space between Kalender and User1 ... 
Example KalenderUser1 or Kalender-User1
Otherwise you will get a list whit all possible syntax...

Hi Theo,

@theodorm said in Script for adding Shared Folders:

Pleas note if you wand name your Kalender Kalender User1 then it's not working if there are space between Kalender and User1 ... 
Example KalenderUser1 or Kalender-User1
Otherwise you will get a list whit all possible syntax...

using z-push-admin it’s possible to add folders which contain spaces in the name, e.g.

z-push-admin -a addshared -u ol -n "Project 2" -f ef66451d403a42a09067f23ce7e6b599170700000000 -o system -t email
z-push-admin -a list -u ol --shared

Synchronized devices of user: ol
-----------------------------------------------------
DeviceId:		65aa
Device type:		WindowsOutlook
UserAgent:		Outlook/15.0 (15.0.4971.1000; C2R; x86)
Additional Folders:	1
	Folder name:	Project 2
	Store:		system
	Type:		Email
	Origin:		Shared
	Folder id:	ef66451d403a42a09067f23ce7e6b599170700000000
	Parent id:	0
	Synched:	Active
	------------------------
Kopano Outlook Extension:
	Version:	1.6.254
	Build:		873f554c71cfa9e1105c47c80cfe7ca5e081d537
	Build Date:	2017-12-01 09:57
	Capabilities:	receiveflags,sendflags,bcc,oof,ooftime,sharedfolders,webapp,freebusy,gab,notes,secondarycontacts,sendas,signatures,debugsupport,syncstate,deliveryreceipts
	Last access:	2018-03-21
Attention needed:	No errors known
-----------------------------------------------------

Manfred

@manfred thank you Manfred, whit this script it was not working for me whit a space…

Hi Theo,

just an update, on some systems you might need to quote the space with backslash:

z-push-admin -a addshared -u ol -n "Project\ 2" -f ef66451d403a42a09067f23ce7e6b599170700000000 -o system -t email

Manfred

HI,

will update the master today, so you can define in the VARS section if spaces should be masked or using it as is

//EDIT: just updated the file - choose in the VARs section " use_mask_spaces="(true|false)" "
working for me, replacing spaces " " with "\ " - can you confirm on your dist?

@theodorm im quite familiar with kopano and administration but since im a network administrator, managing servers etc. and no developer (just a hobby scripter :) ) i dont think i could create a good, bugfree plugin in time, so best would be if someone who can do this on the fly would create that or you could identify the mdm plugin failure. Like i said, i will use some private time on the plugin but no guaratee on even accomplishing that.

coffee_is_life