Good day!

I wanted to programmatically create a library. Manually in lightning mode you need to navigate to Files tab and then choose Libraries and then click the New Library button. Supply a name and description and then your library is created.

I noticed this action is inserting records in ContentWorkspace and in ContentFolder. I am just not sure if it is inserting in any other table.

My questions is, can I normally insert via soql in apex? Or do I need to use an external api tool(MetadataAPI or ToolingAPI) for this? I also wanted to know the involved object for this so is there any reference for the connections of such?


1 Answer 1


If you want to use APIs (to keep this very simple) you can:

However if you are trying to do this programmatically - I assume you mean via Apex? In which case you can create these via Apex (there are a couple of ways to do this, here is an example of using Connect API)

  • Thanks man! I didn't use the ConnectApi object but instead a raw http request using the REST Api in one of your links.
    – Oneb
    Nov 29, 2019 at 7:56

You must log in to answer this question.

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