Cli-microsoft365: Documentation: Update examples that use comma separated values as command options

Created on 6 Feb 2020  路  4Comments  路  Source: pnp/cli-microsoft365

Raised from #1346 & #1342

Currently all commands that accept comma-separated lists as option values do not wrap their values in quotes, for example, aad user list --properties displayName,mail.

Executing the example in PowerShell will fail due to the way that it handles commas passed as arguments. (https://stackoverflow.com/questions/11990688/powershell-is-removing-comma-from-program-argument)

All examples using comma-separated lists as values should be updated, e.g. aad user list --properties "displayName,mail". Wrapping the values in quotes ensures that the command will function correctly in different shells.

A quick search reveals the following commands all have an option that accepts a comma separated list.

  • [ ] aad/o365group/o365group-add
  • [ ] aad/o365group/o365group-set
  • [ ] aad/siteclassification/siteclassification-enable
  • [ ] aad/siteclassification/siteclassification-set
  • [ ] aad/user/user-get
  • [ ] aad/user/user-list
  • [ ] graph/schemaextension/schemaextension-add
  • [ ] outlook/mail/mail-send
  • [ ] spo/hubsite/hubsite-rights-grant
  • [ ] spo/hubsite/hubsite-rights-revoke
  • [ ] spo/listitem/listitem-get
  • [ ] spo/listitem/listitem-list
  • [ ] spo/mail/mail-send
  • [ ] spo/page/page-header-set
  • [ ] spo/search/search
  • [ ] spo/site/site-add
  • [ ] spo/site/site-classic-set
  • [ ] spo/sitedesign/sitedesign-add
  • [ ] spo/sitedesign/sitedesign-rights-grant
  • [ ] spo/sitedesign/sitedesign-rights-revoke
  • [ ] spo/sitedesign/sitedesign-set
  • [ ] teams/team/team-clone
docs work in progress

Most helpful comment

Feel free to assign to me

All 4 comments

Feel free to assign to me

Thanks @appieschot its all yours!

@garrytrinder there are a few that could have a , but in the current samples do not have that provided by default, or already have the " around them. For instance:
aad/siteclassification/siteclassification-enable already has quotes, and spo/mail/mail-send uses single quotes. Quick two questions:

  • Will single quotes be sufficient as well or do you expect changes there?
  • In commands where currently the samples miss a sample with the comma shall I add an additional sample with the quotes to make sure they all work?

Will single quotes be sufficient as well or do you expect changes there?

I would say lets go with double quotes " rather than single for consistency, as you are more likely to use a single quote in a string i.e. "O'Neill" so causes less issues

In commands where currently the samples miss a sample with the comma shall I add an additional sample with the quotes to make sure they all work?

That would be great if you could as it would increase the quality of the examples 馃憤馃徎

Was this page helpful?
0 / 5 - 0 ratings