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

How to add multiple person and group field inside folder? #1

Open
samsiddiquiz opened this issue Apr 2, 2019 · 3 comments
Open

How to add multiple person and group field inside folder? #1

samsiddiquiz opened this issue Apr 2, 2019 · 3 comments

Comments

@samsiddiquiz
Copy link

{ FieldName: 'PersonField', FieldValue: JSON.stringify([{ Key: userName },{ Key: userName }]) },

I tried this, but this not working, can you help me out ?
Thanks in advance

@koltyakov
Copy link
Owner

Hey @samsiddiquiz,

One can't "add a field to folder" but can update item (which already in folder) or create a new item in the folder. addValidateUpdateItemUsingPath can be used for creating items in a folder. Here is the sample.

@samsiddiquiz
Copy link
Author

Hey @koltyakov
Thank you, i am trying to create item in folder, where field is Person and Group Multiple is true, can you guide me how to set FieldValue for Person and Group Multiple field ?

@koltyakov
Copy link
Owner

koltyakov commented Apr 2, 2019

MultiUser payload you mentioned is correct, so validateUpdateListItem for updates and addValidateUpdateItemUsingPath for item creation.

Example:

sp.web.lists.getByTitle('List Name').items.getById(1)
    .validateUpdateListItem([
        { 
            FieldName: 'MultiUser',
            FieldValue: JSON.stringify([
                { Key: 'i:0#.f|membership|user1@contoso.onmicrosoft.com', IsResolved: true },
                { Key: 'i:0#.f|membership|user2@contoso.onmicrosoft.com', IsResolved: true },
                { Key: 'i:0#.f|membership|user3@contoso.onmicrosoft.com', IsResolved: true }
            ])
        }
    ])
    .then(console.log);

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

No branches or pull requests

2 participants