Hi, I try the same, but I always get a "HRESULT E_Fail-Error" if I give the reference of the layer as SourceLayer. It works only with the layername (as string). What can I do? I don't want to use the layernames, because they are not unique. Here is the code (VB.NET):
Friend Sub SaveAsLayerpackage(ByVal pLayer As ESRI.ArcGIS.Carto.ILayer, _ ByVal pOutPkgfilename As String)
Dim GP As New ESRI.ArcGIS.Geoprocessor.Geoprocessor
Dim pkgTool As New ESRI.ArcGIS.DataManagementTools.PackageLayer
'this works:
pkgTool.in_layer = pLayer.Name
'this don't work: pkgTool.in_layer = pLayer
pkgTool.output_file = pOutPkgfilename
GP.Execute(pkgTool, Nothing)
End Sub
Hagen
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.