Select to view content in your preferred language

Retrieve current SDE version

1132
1
Jump to solution
08-03-2012 09:54 AM
OlivierVoyer
Occasional Contributor
Hi,

I'm trying to get the current SDE version, for example "SDE.DEFAULT" of the current workspace.

I'm currently using the following code, but it always returns "SDE.DEFAULT", even when I'm connected to another version.

IWorkspace workspace = ((IDataset)ArcMap.Document.ActiveView.FocusMap.Layer[0]).Workspace; IVersionedWorkspace versionedWorkspace = (IVersionedWorkspace)workspace; String strVer = versionedWorkspace.DefaultVersion.VersionName;


I'm using ArcObjects 9.2.

Thanks!

Oli
0 Kudos
1 Solution

Accepted Solutions
OlivierVoyer
Occasional Contributor
I think I - already - found the solution 😮

IWorkspace workspace = ((IDataset)ArcMap.Document.ActiveView.FocusMap.Layer[0]).Workspace; IVersion version = (IVersion)workspace; String strVer = version.VersionName;

View solution in original post

0 Kudos
1 Reply
OlivierVoyer
Occasional Contributor
I think I - already - found the solution 😮

IWorkspace workspace = ((IDataset)ArcMap.Document.ActiveView.FocusMap.Layer[0]).Workspace; IVersion version = (IVersion)workspace; String strVer = version.VersionName;
0 Kudos