I'm looking for a way to add individual users or a public group to a Library programmatically using Apex.

I've been investigating if there is an API that let me do that, but I had no luck.

I know I can create a public group using Apex, but I don't find a way to link it to a Library.

Thank you in advance! :)


Use the ContentWorkspaceMember object (V40+)

insert new ContentWorkspaceMember(
   ContentWorkspaceId = myLibraryId,
   ContentWorkspacePermissionId = myPermissionId,
   MemberId = theGroupId

where myPermissionId has to be queried in advance from ContentWorkspacePermission

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.