2

Is there a way that Chatter can filter some special file types on uploads? I mean that I want only the PDF file type to be able to be uploaded via Chatter. I searched the Chatter API guide, but I didn't found any description for this.

1 Answer 1

1

You can do this via a trigger:

// Trigger needs to be 'after insert', since FileType is not
// available before insert
trigger FilterChatterFile on ContentVersion (after insert) {
    for (ContentVersion cv : Trigger.new) {
        // Origin is 'H' for Chatter files, 'C' for Content documents
        // Leave out the test for Origin if you want to cover both
        if (cv.Origin == 'H' && cv.FileType != 'PDF') {
            cv.addError('Only PDF files are allowed!');
        }
    }
}
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .