Retrieve current SDE version

926
1
Jump to solution
08-03-2012 09:54 AM
OlivierVoyer
New Contributor II
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
New Contributor II
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
New Contributor II
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