Programmatically Identifying Broken Data Links

Discussion created by ccposton on Feb 17, 2012
Latest reply on Feb 17, 2012 by Neil
In Engine code how can identify the broken data links? When I use the following code I can read the links in a document. If the document has broken links then this code just blows up with a FAIL COM error. I would like to be able to allow the user to repair broken links from Engine code (in other words I am not interested in script solutions.)  Is this even possible in Engine code?  Has anyone ever done this? Does anyone have code that attempts to do this?

            Dictionary<string, string> datasetList_ = new Dictionary<string,string>();
            IDataset dataset = layer as IDataset;
            if ( dataset == null ) return datasetList_;
                IEnumDatasetName enumDatasetName = dataset.Workspace.get_DatasetNames( esriDatasetType.esriDTAny );
                IDatasetName datasetName;
                while ( ( datasetName = enumDatasetName.Next() ) != null ) {

                    datasetList_.Add( datasetName.Name, datasetName.WorkspaceName.PathName );
            return datasetList_;