Navigation

    Kopano
    • Register
    • Login
    • Search
    • Categories
    • Get Official Kopano Support
    • Recent
    Statement regarding the closure of the Kopano community forum and the end of the community edition

    Script for adding Shared Folders

    Synchronising (mobile) devices via Z-Push
    6
    19
    2866
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Coffee_is_life
      Coffee_is_life last edited by Coffee_is_life

      Hello again,

      im done with the first basic version, created on RHEL 7 (CentOS 7 with php56) - choosing device not implemented yet
      confirmed working for emails, calendars and contacts.
      i think there are some better programmers out there who can optimize it a bit :)

      should i copy the raw bash code here or another scripting location?

      coffee_is_life

      Sebastian 1 Reply Last reply Reply Quote 0
      • BusinessTux
        BusinessTux last edited by

        Perhaps kopano-python is also a solution to find the user id: https://documentation.kopano.io/kopano_python_kopano/getting_started.html

        1 Reply Last reply Reply Quote 0
        • Sebastian
          Sebastian Kopano @Coffee_is_life last edited by

          @coffee_is_life You could create a gist on github for it.

          1 Reply Last reply Reply Quote 0
          • Coffee_is_life
            Coffee_is_life last edited by Coffee_is_life

            Good Morning,

            i’ve created a branch for that on git:

            https://github.com/Coffee-IsLife/Z-Push-shared-folders

            there will come updates such as adding a device-choice but not today, but i think this week.

            Feel free to correct some ways i did in the script - was a 2h quick solution :)
            but in most cases it might help some users to add folders without searching every folderid etc.

            //EDIT: ok, got some time - device-choice is added

            coffee_is_life

            1 Reply Last reply Reply Quote 0
            • theodorm
              theodorm last edited by

              Hi @Coffee_is_life , seems great work.

              Will this also work for the univention server which has a debian 9 base now?
              Maybe you can turn this in to a plugin to in case the MDM Plugin is not working for me.

              1 Reply Last reply Reply Quote 0
              • Coffee_is_life
                Coffee_is_life last edited by

                HI @theodorm,

                i’m not familiar with plugins neither with debian. - since im using buildin linux commands and not using full paths this should work with debian aswell. feel free to test it on a testuser :)

                i will look into plugin building and report back if i can or cannot accomplish that

                are there some guidlines somewhere (remember to saw it somewhere ^^)

                coffee_is_life

                1 Reply Last reply Reply Quote 0
                • Coffee_is_life
                  Coffee_is_life last edited by

                  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

                  1 Reply Last reply Reply Quote 0
                  • theodorm
                    theodorm last edited by

                    @Coffee_is_life
                    sounds great!!!..

                    1 Reply Last reply Reply Quote 0
                    • fbartels
                      fbartels Kopano last edited by

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

                      Regards Felix

                      Resources:
                      https://kopano.com/blog/how-to-get-kopano/
                      https://documentation.kopano.io/
                      https://kb.kopano.io/

                      Support overview:
                      https://kopano.com/support/

                      theodorm 1 Reply Last reply Reply Quote 0
                      • theodorm
                        theodorm @fbartels last edited by theodorm

                        @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…

                        1 Reply Last reply Reply Quote 0
                        • Coffee_is_life
                          Coffee_is_life last edited by

                          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

                          1 Reply Last reply Reply Quote 0
                          • theodorm
                            theodorm last edited by theodorm

                            @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...
                            
                            Manfred 1 Reply Last reply Reply Quote 0
                            • Manfred
                              Manfred Kopano @theodorm last edited by Manfred

                              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

                              theodorm 1 Reply Last reply Reply Quote 0
                              • theodorm
                                theodorm @Manfred last edited by

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

                                Manfred 1 Reply Last reply Reply Quote 0
                                • Manfred
                                  Manfred Kopano @theodorm last edited by

                                  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

                                  1 Reply Last reply Reply Quote 0
                                  • Coffee_is_life
                                    Coffee_is_life last edited by Coffee_is_life

                                    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

                                    1 Reply Last reply Reply Quote 0
                                    • First post
                                      Last post