Skip to content

feature/spo-listitem-set resolves office365-cli issue #271#454

Closed
mpowney wants to merge 8 commits intopnp:devfrom
mpowney:feature/spo-listitem-set
Closed

feature/spo-listitem-set resolves office365-cli issue #271#454
mpowney wants to merge 8 commits intopnp:devfrom
mpowney:feature/spo-listitem-set

Conversation

@mpowney
Copy link
Copy Markdown
Contributor

@mpowney mpowney commented May 13, 2018

feature/spo-listitem-set all changes to new branch from upstream dev

@coveralls
Copy link
Copy Markdown

coveralls commented May 13, 2018

Coverage Status

Coverage remained the same at 100.0% when pulling 1cc4b65 on mpowney:feature/spo-listitem-set into 4b0e372 on SharePoint:dev.

@mpowney
Copy link
Copy Markdown
Contributor Author

mpowney commented May 13, 2018

This PR is a clean version of the previous PR I submitted - adds a new cmd to update list items: #271

@waldekmastykarz
Copy link
Copy Markdown
Member

Awesome! Thanks @mpowney!

@waldekmastykarz waldekmastykarz self-assigned this May 13, 2018
@waldekmastykarz
Copy link
Copy Markdown
Member

Was just about to review it @mpowney 😉 All good now? 😄

@mpowney
Copy link
Copy Markdown
Contributor Author

mpowney commented May 19, 2018

Yes just a minor update, all good

@waldekmastykarz
Copy link
Copy Markdown
Member

waldekmastykarz commented May 19, 2018

I'm getting a Exception of type 'Microsoft.IdentityModel.Tokens.AudienceUriValidationFailedException' was thrown. error, when trying to run systemUpdate on an item when connected to tenant admin. Could you please have a look @mpowney?

Update: I'm getting the error both when using the systemUpdate as well as when performing a regular update on a list item in a site collection when connected to the tenant admin.

@mpowney
Copy link
Copy Markdown
Contributor Author

mpowney commented May 21, 2018

Hey @waldekmastykarz I've tried the following to reproduce the error you're getting:

  1. Using npm command prompt, run the following: o365 spo connect https://<tenantname>l.sharepoint.com/sites/<moderncommssitepath>
  2. Use OAuth2 devicelogin to authenticate with an account that is a tenant admin
  3. Run the following: o365 spo listitem set --webUrl https://<tenantname>.sharepoint.com/sites/<moderncommssitepath> --listTitle CustomList --id 48 --Title "Updated from office365-cli" (no system update)
  4. Run the following: o365 spo listitem set --webUrl https://<tenantname>.sharepoint.com/sites/<moderncommssitepath> --listTitle CustomList --id 48 --Title "Updated from office365-cli" --systemUpdate (with system update)
  5. Run the following: o365 spo listitem set --webUrl https://<tenantname>.sharepoint.com/sites/<moderncommssitepath>/ --listTitle CustomList --id 48 --Title "Updated from office365-cli" --systemUpdate (trailing slash on the end of the webUrl path)
  6. Run the following: o365 spo listitem set --webUrl https://<tenantname>.sharepoint.com/sites/<moderncommssitepath> --listTitle CustomList --id 48 --Title "Updated from office365-cli" --systemUpdate --debug (debug enabled)

All of the above work OK for me. Can you provide more detail, e.g. the actual command(s) causing the error?

@mpowney
Copy link
Copy Markdown
Contributor Author

mpowney commented May 21, 2018

Just re-reading your previous comment @waldekmastykarz - are you connecting to the tenant admin site i.e. https://-admin.sharepoint.com - if so, what list are you updating there?

@waldekmastykarz
Copy link
Copy Markdown
Member

Sorry for the confusion @mpowney. I am connecting to the tenant admin site in the CLI (spo connect https://contoso-admin.sharepoint.com) and then, I'm updating a listitem in a regular site (spo listitem set -u https://contoso.sharepoint.com/sites/team-a ...).

Connecting to the tenant admin site is how I typically use the CLI because it doesn't require me to reconnect whenever I need to use a command that requires tenant admin site connection.

Hope this clarifies it a bit.

@mpowney
Copy link
Copy Markdown
Contributor Author

mpowney commented May 25, 2018

I think that's fixed now @waldekmastykarz. I'm on my way back from SPC18, and I literally performed the debugging, commit and push from 32kft, above Hawaii in the Pacific!

@waldekmastykarz
Copy link
Copy Markdown
Member

Brilliant! In that case it's going to work for sure. Thanks! Hope you had a nice event.

@mpowney
Copy link
Copy Markdown
Contributor Author

mpowney commented May 25, 2018

Hashtag-spc18inspiration

@waldekmastykarz
Copy link
Copy Markdown
Member

When I'm trying to update a list item using the listId option, I'm getting the following error:

Error: The expression "web/lists/(guid'a3815d57-23cb-4c5f-a0fb-455c43ae2a9d')/items(1)/ValidateUpdateListItem()" is not valid.

Command:

o365 spo listitem set --listId a3815d57-23cb-4c5f-a0fb-455c43ae2a9d --id 1 --webUrl https://m365x526922.sharepoint.com/sites/team-a --PnPCity "Tampa, FL"

Could you see if you can repro it @mpowney? Updating item using listTitle works as expected.

@mpowney
Copy link
Copy Markdown
Contributor Author

mpowney commented Jun 10, 2018

Hey @waldekmastykarz, I've reproduced the error

Error: The expression "web/lists/(guid'a3815d57-23cb-4c5f-a0fb-455c43ae2a9d')/items(1)/ValidateUpdateListItem()" is not valid

and fix is now committed. Also re-based with dev.

@waldekmastykarz
Copy link
Copy Markdown
Member

Awesome! Thanks @mpowney!

@waldekmastykarz
Copy link
Copy Markdown
Member

The issue with listId seems to be fixed, but I've found something else. If I use the --systemUpdate option, I'm getting the following error:

Error: Invalid JWT token. The token is expired.

I'm connected to the tenant admin site and trying to update an item in a regular site collection.

Copy link
Copy Markdown
Member

@waldekmastykarz waldekmastykarz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The command returns error when using the --systemUpdate option and connected to the tenant admin site.

@mpowney mpowney force-pushed the feature/spo-listitem-set branch from 39660b9 to 1cc4b65 Compare June 17, 2018 06:25
@mpowney
Copy link
Copy Markdown
Contributor Author

mpowney commented Jun 17, 2018

Hey @waldekmastykarz thanks for testing that scenario, I've fixed the getRequestDigest call to use getRequestDigestForSite instead when --systemUpdate is called. It looks like it's working as expected now.

@waldekmastykarz
Copy link
Copy Markdown
Member

Thanks @mpowney! Will check it out!

@waldekmastykarz
Copy link
Copy Markdown
Member

Went through the PR and it's looking perfect. Included in the upcoming release. Thanks @mpowney!

@waldekmastykarz
Copy link
Copy Markdown
Member

Merged manually

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants