touchtable

ILayerFile.Save() fails with COM Exception

Discussion created by touchtable on May 5, 2010
Latest reply on May 12, 2010 by touchtable
Hi,
I'm trying to save all the layers from a Globe Document out to layer files.
I have code like this:

IEnumLayer baseLayers = globe.get_GlobeLayers(null, true, true, true);
for (ILayer lyr = baseLayers.Next(); lyr != null; lyr = baseLayers.Next())
{
     ....

     ILayerFile lf = new LayerFileClass();
     lf.New(somePathName);
     lf.ReplaceContents(lyr);
     lf.Save();
     lf.Close();
}

However, lf.Save() always fails with a COM Exception on every layer.
This is at 9.3.1.
What am I doing wrong?

Thanks.

Outcomes