Getting path to MXD using IDocumentInfo2

Discussion created by jeffhamblin on Jun 21, 2011
Latest reply on Jun 22, 2011 by jeffhamblin
I need to get the path to the currently open map document for a C# Add-In.

While searching, I found several references that use essentially the following:
public string GetActiveDocumentPath(IApplication application)
    // The active document is always the last template
    ITemplates templates = application.Templates;
    return templates.get_Item(templates.Count - 1);

called with:
string mxdPath = GetActiveDocumentPath(ArcMap.Application);

Then I found IDocumentInfo2.Path in the documentation, and it seems to work fine:
public string GetActiveDocumentPath(IMapDocument mapDocument)
    IDocumentInfo2 docInfo = mapDocument as IDocumentInfo2;
    return docInfo.Path;

called with:
string mxdPath = GetActiveDocumentFolder(ArcMap.Document as IMapDocument);

My question is if anyone knows of any reasons to use one versus the other.