Programmatically creating new Workspaces

2025/04/25 4:28 PM

Hi, is there an API to create workspaces?

I can see there is a method to get a workspace root IContentFolderManager.GetRoot(workspaceName)

This throws an exception if the workspace does not exist.

However, I can't see an equivalent CreateRoot(), a suitable overload of IContentFolderManager.Create, or properties of CreateContentFolderParameters that would facilitate this.

Thanks.

Environment

Answers

2025/04/25 5:11 PM
Answer

I think you can use WorkspaceInfo directly - a workspace is just a logical container that a content item, smart folder, or content folder is associated with.

public class MyService(IInfoProvider<WorkspaceInfo> provider)
{
  private reasonly IInfoProvider<WorkspaceInfo> provider = provider;

  public Task CreateWorkspace(...)
  {
    var newWorkspace = new WorkspaceInfo()
    {
      WorkspaceName = "...",
      DisplayName = "..."
    };

    await provider.SetAsync(newWorkspace);
  }
}
2025/04/28 9:05 AM

Yes, that works perfectly thanks.

To answer this question, you have to login first.