ArcObjects Library Reference

Get Document Path Snippet

Get the active document path for the ArcGIS application.

[C#]

///<summary>Get the active document path for the ArcGIS application.</summary>
///  
///<param name="application">An IApplication interface.</param>
///   
///<returns>A System.String is returned that is the path for the document.</returns>
///  
///<remarks></remarks>
public System.String GetActiveDocumentPath(ESRI.ArcGIS.Framework.IApplication application)
{
  ESRI.ArcGIS.Framework.ITemplates templates = application.Templates;
  return templates.get_Item(templates.Count - 1);
}
[Visual Basic .NET]

'''<summary>Get the active document path for the ArcGIS application.</summary>
'''  
'''<param name="application">An IApplication interface.</param>
'''   
'''<returns>A System.String is returned that is the path for the document.</returns>
'''  
'''<remarks></remarks>
Public Function GetActiveDocumentPath(ByVal application As ESRI.ArcGIS.Framework.IApplication) As System.String

  Dim templates As ESRI.ArcGIS.Framework.ITemplates = application.Templates

  Return templates.Item(templates.Count - 1)

End Function


Additional Requirements
  • The code in this document requires the following References added to the Visual Studio project:
  • ESRI.ArcGIS.Framework