update sharepoint cli examples

Updates the sharepoint cli examples to better
reflect the current support and utilities.
This commit is contained in:
ryanfkeepers 2023-03-15 15:47:20 -06:00
parent 91328d9898
commit f80c5575b4
3 changed files with 36 additions and 43 deletions

View File

@ -50,7 +50,7 @@ const (
corso backup create sharepoint --web-url <siteURL>
# Backup SharePoint for two sites: HR and Team
corso backup create sharepoint --site https://example.com/hr,https://example.com/team
corso backup create sharepoint --web-url https://example.com/hr,https://example.com/team
# Backup all SharePoint data for all Sites
corso backup create sharepoint --web-url '*'`
@ -59,13 +59,15 @@ corso backup create sharepoint --web-url '*'`
corso backup delete sharepoint --backup 1234abcd-12ab-cd34-56de-1234abcd`
sharePointServiceCommandDetailsExamples = `# Explore a site's files from backup 1234abcd-12ab-cd34-56de-1234abcd
corso backup details sharepoint --backup 1234abcd-12ab-cd34-56de-1234abcd
corso backup details sharepoint --backup 1234abcd-12ab-cd34-56de-1234abcd --web-url https://example.com
# Find all site files that were created before a certain date.
# Find all files that were created before a certain date.
corso backup details sharepoint --backup 1234abcd-12ab-cd34-56de-1234abcd \
--web-url https://example.com --file-created-before 2015-01-01T00:00:00
--file-created-before 2015-01-01T00:00:00 --folder "Display Templates/Style Sheets"
# Find all files within a specific library.
corso backup details sharepoint --backup 1234abcd-12ab-cd34-56de-1234abcd \
--library documents --folder "Display Templates/Style Sheets"
`
)
@ -104,8 +106,9 @@ func addSharePointCommands(cmd *cobra.Command) *cobra.Command {
case listCommand:
c, fs = utils.AddCommand(cmd, sharePointListCmd())
fs.StringVar(&backupID,
"backup", "",
fs.StringVar(
&backupID,
utils.BackupFN, "",
"Display a specific backup, including the items that failed or were skipped during processing.")
addFailedItemsFN(c)
@ -120,7 +123,8 @@ func addSharePointCommands(cmd *cobra.Command) *cobra.Command {
options.AddSkipReduceFlag(c)
fs.StringVar(&backupID,
fs.StringVar(
&backupID,
utils.BackupFN, "",
"ID of the backup to retrieve.")
cobra.CheckErr(c.MarkFlagRequired(utils.BackupFN))
@ -142,16 +146,6 @@ func addSharePointCommands(cmd *cobra.Command) *cobra.Command {
utils.FileFN, nil,
"Select backup details by file name.")
fs.StringArrayVar(
&utils.Site,
utils.SiteFN, nil,
"Select backup details by site ID; accepts '"+utils.Wildcard+"' to select all sites.")
fs.StringSliceVar(
&utils.WebURL,
utils.WebURLFN, nil,
"Select backup data by site webURL; accepts '"+utils.Wildcard+"' to select all sites.")
fs.StringSliceVar(
&pageFolders,
utils.PageFolderFN, nil,
@ -191,7 +185,8 @@ func addSharePointCommands(cmd *cobra.Command) *cobra.Command {
c.Use = c.Use + " " + sharePointServiceCommandDeleteUseSuffix
c.Example = sharePointServiceCommandDeleteExamples
fs.StringVar(&backupID,
fs.StringVar(
&backupID,
utils.BackupFN, "",
"ID of the backup to delete. (required)")
cobra.CheckErr(c.MarkFlagRequired(utils.BackupFN))

View File

@ -45,16 +45,6 @@ func addSharePointCommands(cmd *cobra.Command) *cobra.Command {
"ID of the backup to restore. (required)")
cobra.CheckErr(c.MarkFlagRequired(utils.BackupFN))
fs.StringSliceVar(
&utils.Site,
utils.SiteFN, nil,
"Restore data by site ID; accepts '"+utils.Wildcard+"' to select all sites.")
fs.StringSliceVar(
&utils.WebURL,
utils.WebURLFN, nil,
"Restore data by site webURL; accepts '"+utils.Wildcard+"' to select all sites.")
// sharepoint hierarchy (path/name) flags
fs.StringVar(
@ -132,13 +122,17 @@ const (
sharePointServiceCommandRestoreExamples = `# Restore file with ID 98765abcdef
corso restore sharepoint --backup 1234abcd-12ab-cd34-56de-1234abcd --file 98765abcdef
# Restore a Site's file named "ServerRenderTemplate.xsl in "Display Templates/Style Sheets" from a specific backup
# Restore a file named "ServerRenderTemplate.xsl in "Display Templates/Style Sheets".
corso restore sharepoint --backup 1234abcd-12ab-cd34-56de-1234abcd \
--web-url https://example.com --file "ServerRenderTemplate.xsl" --folder "Display Templates/Style Sheets"
--file "ServerRenderTemplate.xsl" --folder "Display Templates/Style Sheets"
# Restore all files from a Site that were created before 2020 when captured in a specific backup
# Restore all files that were created before 2020.
corso restore sharepoint --backup 1234abcd-12ab-cd34-56de-1234abcd
--web-url https://example.com --folder "Display Templates/Style Sheets" --file-created-before 2020-01-01T00:00:00`
--file-created-before 2020-01-01T00:00:00 --folder "Display Templates/Style Sheets"
# Restore all files in a certain library.
corso restore sharepoint --backup 1234abcd-12ab-cd34-56de-1234abcd
--library documents --folder "Display Templates/Style Sheets" `
)
// `corso restore sharepoint [<flag>...]`

View File

@ -15,15 +15,19 @@ const (
)
type SharePointOpts struct {
FileNames []string // for libraries, to duplicate onedrive interface
FolderPaths []string // for libraries, to duplicate onedrive interface
Library string
ListItems []string
ListPaths []string
PageFolders []string
Pages []string
Sites []string
WebURLs []string
Library string
FileNames []string // for libraries, to duplicate onedrive interface
FolderPaths []string // for libraries, to duplicate onedrive interface
ListItems []string
ListPaths []string
PageFolders []string
Pages []string
Sites []string
WebURLs []string
FileCreatedAfter string
FileCreatedBefore string
FileModifiedAfter string