northpole

Error Message: The workspace is not connected

Discussion created by northpole on Nov 26, 2011
Latest reply on Jul 6, 2016 by cdebruin
Hello everyone,
I am trying to automate replication for ArcSDE and am trying to follow instructions from ESRI webhelp at URL 'http://help.arcgis.com/en/sdk/10.0/vba_desktop/conceptualhelp/index.html#/How_to_create_a_replica/000100000063000000/'. I am consistently getting an error message saying '"The workspace is not connected"'. I tried searching the forum for this error but could not get find anything useful in this regard.

I am using C# and ArcGIS Desktop 10. Any helpful insight would be appreciated in this regard.

Thanks in advance.

// *******Code Snippet************

IGeoDataServer geoDataServer=null;
IGeoDataServerInit geoDataServerInit;

geoDataServer = new GeoDataServerClass();
geoDataServerInit = (IGeoDataServerInit)geoDataServer;
geoDataServerInit.InitFromConnectionString(gdbConnectionString);

IReplicationAgent pRepAgent;
IGPReplicaOptions2 pReplicaOptions;
IGPReplicaDescription pGPReplicaDesc;
IGPReplicaDatasets pGPReplicaDatasets;
IGPReplicaDatasets pGPReplicaDatasets_Expand;
IGPReplicaDataset pGPReplicaDataset;

pGPReplicaDesc = new GPReplicaDescriptionClass();
pGPReplicaDatasets = new GPReplicaDatasetsClass();
pGPReplicaDataset = new GPReplicaDatasetClass();

               
pGPReplicaDataset.DatasetType = esriDatasetType.esriDTFeatureDataset;
pGPReplicaDataset.Name = "SampleFeatureDatasetName";

pGPReplicaDatasets.Add(pGPReplicaDataset);
pGPReplicaDatasets_Expand = sourceGeoDataServer.ExpandReplicaDatasets(pGPReplicaDatasets);

pGPReplicaDesc.ReplicaDatasets = pGPReplicaDatasets_Expand;
pGPReplicaDesc.ModelType = esriReplicaModelType.esriModelTypeFullGeodatabase;

pGPReplicaDesc.SingleGeneration = (lAccType == esriReplicaAccessType.esriReplicaAccessNone);
pGPReplicaDesc.SpatialRelation = esriSpatialRelEnum.esriSpatialRelIndexIntersects;

pReplicaOptions = new GPReplicaOptionsClass();
pReplicaOptions.AccessType = lAccType;
pReplicaOptions.ChildReconcilePolicy = esriReplicaReconcilePolicyType.esriReplicaResolveConflictsInFavorOfImportedChanges;
pReplicaOptions.ParentReconcilePolicy = esriReplicaReconcilePolicyType.esriReplicaResolveConflictsNone;
pReplicaOptions.IsChildFirstSender = true;

pRepAgent = new ReplicationAgent();
               
pRepAgent.CreateReplica(versionName, sourceGeoDataServer, targetGeoDataServer, replicaName, pGPReplicaDesc, pReplicaOptions);

Outcomes