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

Simplify to set user field value when add a list item #915

Closed
matsla opened this issue Jul 1, 2022 · 4 comments
Closed

Simplify to set user field value when add a list item #915

matsla opened this issue Jul 1, 2022 · 4 comments
Assignees
Labels
area: framework ⚙ Changes in the SDK core framework code

Comments

@matsla
Copy link

matsla commented Jul 1, 2022

To handle user values for a list item. Can't this be simplified?
https://pnp.github.io/pnpcore/using-the-sdk/listitems-fields.html#user-fields

Support to crate an instance of FieldUserValue, it's now protected.

FieldUserValue userValue = new FieldUserValue();
userValue.LookupId = user.Id; // user => ensuredUser

values.Add("MyUserField", userValue);

var addedItem = await myList.Items.AddAsync(values);

@jansenbe
Copy link
Contributor

@matsla : originally we needed the IField reference when processing list items, but after a refactoring a while ago this seems to be not relevant anymore (at least after a quick code check)...so, I think we can simplify the model a bit here. Will do some more checking / prototyping and will, if all turns out fine, update our code.

@jansenbe jansenbe self-assigned this Jul 13, 2022
@jansenbe jansenbe added the area: framework ⚙ Changes in the SDK core framework code label Jul 13, 2022
@jansenbe
Copy link
Contributor

@matsla : the simplified model has been implemented, from now on you can directly instantiate the needed FieldXXXValue and FieldValueCollection classes without requiring a reference to the used IField. See https://pnp.github.io/pnpcore/using-the-sdk/listitems-fields.html#url-fields for the updates docs.

@trueleader
Copy link

@jansenbe Any idea when this will be released?

@jansenbe
Copy link
Contributor

We are actually planning a release soon, probably next week already

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
Projects
None yet
Development

No branches or pull requests

3 participants