Programmatically creating new Workspaces

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

Tags:
Workspaces C#
0

Answers

Accepted 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);
  }
}
0

Yes, that works perfectly thanks.

0

To response this discussion, you have to login first.