NAME

sp-client - a sample Microsoft SharePoint client implementing Net::SharePoint::Basic

SYNOPSIS

sp-client - a sample Microsoft SharePoint client implementing Net::SharePoint::Basic

This client is capable of executing all of the module's commands (upload, download, list, makedir and delete), while also providing examples of how you can validate the necessary arguments and deal with the response codes.

Usage information (available with the -h|--help switch):

 $ ./sp-client --help
 Client stub for a SharePoint portal
 Copyright (C) 2018-2019 VMware Inc.
 Usage: ./sp-client -h|--help | -V|--version | [-v|--verbose | -d|--debug] [ -f|--config-file CONFIG_FILE ] [ -t|--token-file FILE ] [ -l|--log-file FILE ] [ --retries RETRIES ] [ --max-log-size SIZE] [ --chunk-size SIZE ] CMD SHAREPOINTPATH {LOCALPATH|SHAREPOINT-TARGET}
 Options:
        -h|--help                 print this message and exit
        -V|--version              print version of the package and exit
        -v|--verbose              produce verbose output to STDERR
        -d|--debug                produce debug output to STDERR
        -f|--config-file CONFIG   use CONFIG file instead of
                                  /etc/sharepoint.conf
        -t|--token-file  FILE     use token file FILE instead of
                                  /var/run/sharepoint.token
           --retries     RETRIES  set the number of retries to RETRIES
                                  instead of 3
           --max-log-size SIZE    set the max log history size to SIZE
                                  instead of 500000
           --chunk-size   SIZE    set the upload chunk size to SIZE
                                  instead of 200000000
 Arguments:
        CMD                       command, one of
                                  copy, delete, download, list, makedir, upload, move
        SHAREPOINTPATH            remote path to operate upon
        LOCALPATH                 {for download and upload}
                                  files to upload into sharepoint or
                                   path to store the download 
                                  OR
        SHAREPOINT-TARGET         {for copy and move}
                                  destination for moved or copied object
Note: use delete for both files and folders

SUBROUTINES/METHODS

validate_args ()

Validates the arguments to the client. Uses @ARGV as parameters. Checks if the command is recognized, and whether the list, delete and makedir commands receive one argument, and upload/download receive two. Returns the lowercased valid command for future use.

Provides an example on how to process the data returned by the list() method of Net::SharePoint::Basic . The items are listed in alphabetical order. The folders have '/' attached to their name, and their item count is used as 'size'.

Prints "No contents detected" if the folder is empty.

process_result ($$)

Processes the results of the executed command. In most cases the last message stored in the log ($object->{log} is being used, as $object->{log}[-1][2]. For listed items see print_list_report. When deletion is requested for a non-existent item, a warning is emitted.

LICENSE AND COPYRIGHT

Copyright 2018-2019 VMware.com

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See file LICENSE.txt for more information.