Insufficient Privileges: You do not have the level of access necessary to perform the operation you requested. Please contact the owner of the record or your administrator if access is necessary. Exception when using ConnectAPI.Topics.assignTopic()
This Exception occurs if the running user doesn’t have access to the record to which the topic is getting assigned.
Sample Code:
ConnectAPI.Topic objTopic = ConnectAPI.Topics.assignTopic(
null, '5008c00001LUsBWAA1', '0TO8c0000029lZZGAY'
);
If the running user doesn’t have access to the Case record ‘5008c00001LUsBWAA1’, then it will throw Insufficient Privileges exception.