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:


Any help would be appreciated! Thanks!

  • Where do you set that? I cannot find it. – user2974 May 14 '11 at 8:57

Unfortunately, there's no ArcObjects way to do this. You're going to need to do a mixed C#/Python solution to get what you're aiming for.

|improve this answer|||||
  • Thanks for your answer. I seem to have picked the combo all right. No time aware in ArcPy and no publishing in ArcObjects! – Eddie Jesinsky Feb 10 '11 at 20:37

I was going to suggest using the esriCartoXUI.MapOptimizationAppExtension to convert to an msd, but I don't see any documentation for it. If you figure that part out, I think you can publish the msd by using the AgsServerConnection to get a reference to IServerObjectAdmin3. Then use the methods on it to create a new "configuration".

|improve this answer|||||
  • 1
    Thanks, looking at that it looks like it will be bit of an ordeal to figure out. For now I think I'm going to call a mini arcpy script directly from .NET like so – Eddie Jesinsky Feb 10 '11 at 15:41
  • Yeah that looks much simpler, please post your code when you are done (there's nothing wrong with answering your own question). – Kirk Kuykendall Feb 10 '11 at 16:29
  • I was able to publish the .NET executable to a toolbox and call the python code directly as shown above. However, my current problem is that I suspect that arcpy.mapping.PublishMSDToServer() contains a bug or some undocumented requirement, as when publishing manually, my MSD works correctly, but publishing through that procedure causes incorrect paths to be created and the published MSD does not work. I'm hoping it is some sort of environment setting rather than a bug, so I'm hoping to get some sort of confirmation from ESRI. – Eddie Jesinsky Feb 14 '11 at 13:47
  • I was able to get it working by forcing absolute path names in the mxd when using a geodatabase, or by using the sde as the source instead. – Eddie Jesinsky Feb 14 '11 at 17:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.