Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The code Works fine in 1.4.0 but does not update the person field in 1.5.0 #707

Closed
1 task done
Ofer-Gal opened this issue Jan 8, 2022 · 6 comments
Closed
1 task done
Assignees
Labels
area: framework ⚙ Changes in the SDK core framework code bug Something isn't working

Comments

@Ofer-Gal
Copy link

Ofer-Gal commented Jan 8, 2022

Category

  • Bug

Describe the bug

The Code:
ISharePointUser user = await pnpContext.Web.EnsureUserAsync(item.RequestForEmail); (listItem["Requester"] as IFieldUserValue).Principal = user;
Works fine in 1.4.0 but does not update the person field in 1.5.0

Steps to reproduce

  1. See code code...
    no error

Expected behavior

  • SDK version: 1.5.0
  • OS: . Windows 10
  • SDK used in: Azure Function
  • Framework: .NET 6
  • Browser(s): Chrome
  • Tooling Visual Studio 2022

Thanks for your contribution

@jansenbe jansenbe self-assigned this Jan 8, 2022
@jansenbe jansenbe added area: framework ⚙ Changes in the SDK core framework code question Further information is requested labels Jan 8, 2022
@jansenbe
Copy link
Contributor

jansenbe commented Jan 8, 2022

@Ofer-Gal : are you using UpdateAsync or SystemUpdateAsync/UpdateOverWriteVersionAsync to persist the changes?

@jansenbe
Copy link
Contributor

jansenbe commented Jan 8, 2022

@Ofer-Gal : managed to reproduce your issue, it happens when wanting to set a "null" value to a user principal. Fix is in the works. Thanks for providing the feedback.

@jansenbe jansenbe added bug Something isn't working and removed question Further information is requested labels Jan 8, 2022
@Ofer-Gal
Copy link
Author

Ofer-Gal commented Jan 8, 2022

my update was with await listItem.UpdateAsync(); but the person field was not null but ISharePointUser
Guess I need to learn about SystemUpdateAsync/UpdateOverWriteVersionAsync :-)
The save right after was for a null managed metadata field on same file metadata.

Thank you for fixing. Love your Library

@jansenbe
Copy link
Contributor

Hi @Ofer-Gal : the issue has fixed. The problem was that once an existing field had blank/empty values PnP Core SDK did not correctly load the empty field as IFieldUserValue , IFieldUrlValue, IFieldTaxonomyValue, IFieldLookupValue or IFieldLocationValue resulting one not being to "update" the field (as it was null) or not seeing the change persisted (because the field was not null but not correctly initialized). Please give version 1.5.25 a try and let me know if you still see issues. If all works please close this issue.

@Ofer-Gal
Copy link
Author

1.5.25 works like a charm :-)
Is it "Production ready"?

@jansenbe
Copy link
Contributor

@Ofer-Gal , yes feel free to use it in production.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: framework ⚙ Changes in the SDK core framework code bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants