This code sample illustrates how to add a top-level parent tab to a workspace. It uses the System Artifact Manager API to retrieve the Artifact ID for the system. It then passes this Artifact ID is then CreateAsync() method in the Tab Manager API to create the new tab.
Copy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
public async Task ReadSystemArtifactID()
{
using (ISystemArtifactManager systemArtifactManager = _serviceFactory.CreateProxy<ISystemArtifactManager>())
{
int workspaceID = 1022092;
string artifactIdentifier = "System";
int systemArtifactID = await systemArtifactManager.ReadArtifactIDAsync(workspaceID, artifactIdentifier);
// Use Tab Manager API to create a top-level parent tab in the workspace.
using (ITabManager tabManager = _serviceFactory.CreateProxy<ITabManager>())
{
TabRequest tabRequest = new TabRequest()
{
Name = "New Tab",
Parent = new Securable<ObjectIdentifier>()
{ // Supply artifactID of "System" as parent identifier
Value = new ObjectIdentifier() {ArtifactID = systemArtifactID}
},
IsVisible = true,
LinkType = TabLinkTypeEnum.Parent,
Order = 500
};
TabResponse tabResponse = await tabManager.CreateAsync(workspaceID, tabRequest);
}
}
}