public void ChangeVersionByName(IMxDocument MxDoc, IFeatureWorkspace OldWorkspace, string versionName) { try { //blah blah.... //update the layers in the mxdoc ChangeVersion(pMxDoc, pOldWorkspace as IFeatureWorkspace, pVersion as IFeatureWorkspace); } catch (Exception ex) { } }
How do you assign the pVersion to the current document?
Try following code : public void ChangeVersion(IMxDocument MxDoc, IFeatureWorkspace OldWorkspace, string versionName) { try { //validation if ((pMxDoc == null) || (pOldWorkspace == null) || (String.IsNullOrEmpty(versionName) == true)) { return; } if (!(pOldWorkspace is IVersionedWorkspace)) { return; } IVersionedWorkspace pVersionedWorkspace; IVersion pVersion; pVersionedWorkspace = pOldWorkspace as IVersionedWorkspace; pVersion = pVersionedWorkspace.FindVersion(versionName); if (pVersion == null) { return; } //update the layers in the mxdoc } catch (Exception ex) { } }
public void ChangeVersion(IMxDocument MxDoc, IFeatureWorkspace OldWorkspace, string versionName) { try { //validation if ((pMxDoc == null) || (pOldWorkspace == null) || (String.IsNullOrEmpty(versionName) == true)) { return; } if (!(pOldWorkspace is IVersionedWorkspace)) { return; } IVersionedWorkspace pVersionedWorkspace; IVersion pVersion; pVersionedWorkspace = pOldWorkspace as IVersionedWorkspace; pVersion = pVersionedWorkspace.FindVersion(versionName); if (pVersion == null) { return; } //update the layers in the mxdoc } catch (Exception ex) { } }
SETX ESRI_SOFTWARE_CLASS "Viewer" SETX ESRI_SOFTWARE_CLASS "Editor" SETX ESRI_SOFTWARE_CLASS "Professional"
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.