I have written a triger (before insert) on ContentVersion object and I am checking that the user is going to upload the file in private library or public library.
According to my findings which I got from the documentation of ContentVersion object, there is PublishStatus field in ContentVersion object which determines the library(private/public). But I am not getting the exact value in the PublishStatus field.
There are three possible values for this field
- R => file is uploaded in private library.
- P => file is uploaded in public library.
- U => file uploading is interrupted.
But each time in the before insert trigger I got U.
can anyone help me to identify this please? Thanks!
Best Answer
You have to populate
FirstPublishLocationId
, according to ContentVersion documentation:You can also reference
Special Access Rules
section from the link above where they have listed all requirements for the users trying to publish to public library.