Jul 26 2019 12:36 AM
Hi,
I want to add group to the particular library or list in share point 2013, am using spfx i need any api or solution for the above question, please kindly help me to fix the issue
Jul 26 2019 10:54 AM
Hey @Madhusudana_Yadav_N ,
You mean you have a a list/library with a fied of type "User/ Group" and you want to set this value from your SPFX solution?
If yes, then you can use the PnPJS library to update it. Considering you have a field "Owner" of type User/ Group and a "Members" field that supports multiple Users/ Groups, you can update it using:
sp.web.lists.getByTitle(<ListTitle>).items.getById(<ItemID>).update({
OwnerId: <UserId>,
MembersId: {
results: [<User1ID>, <Group1Id>]
}
})
So basically, you need to append "Id" to the end of the field name and set it to ID of the User/ Group you want. If it is a multiple people field, then you have to set it to an object containing a "results" array, in which each value is an user/ group ID.
Hope it helps.
Aug 04 2019 11:27 PM
Hi, thanks for ur kind reply.
Actually i have list, i want to add new groups to the existing library, and the group which we created should be added to the particular list we specified.
Please kindly give solution or code snippet for the above problem.
Thanks,
Madhusudana Yadav N