[SalesForce] Inserting records to ContentFolder and ContentWorkspace

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?

Thanks!

Best Answer

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)

Related Topic