Hi,
I have an MXD that I would like to publish to an ArcGIS server using C# ArcObjects (preferably as an MSD). I have been unable to find anything regarding this. Essentially I would like to implement the following ArcPy code in ArcObjects:
arcpy.mapping.ConvertToMSD()
arcpy.mapping.PublishMSDToServer()
Any help would be appreciated! Thanks!
you can use code like:
http://www.spoiledtechie.com/post/2010/08/04/How-to-publish-a-ArcMap-to-the-ArcGIS-Servere280a6.aspx and so you can se your properties
For msd see the interface IMSDHelper:
http://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/0012/001200044440000000.htm
IMSDHelper helper = new MSDHelperClass(); helper.Open(mxdName); helper.SaveAs(msdName, false);
RuntimeManager.Bind(ProductCode.Desktop); IAoInitialize objAoInitialize; objAoInitialize = new AoInitializeClass(); objAoInitialize.Initialize(esriLicenseProductCode.esriLicenseProductCodeAdvanced); IMSDHelper helper = new MSDHelperClass(); ...
I recently rewrote my publishing code from python to C#. However, I have yet to figure out how to convert an mxd to msd using IMSDHelper. If anyone has any suggestions please let me know!
p.s. this does not work:IMSDHelper helper = new MSDHelperClass(); helper.Open(mxdName); helper.SaveAs(msdName, false);