Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Help: Get Filename, FilePath via API

ngnam1988
Advocate

Help: Get Filename, FilePath via API

ngnam1988
Advocate
Advocate

Dears,

I can't get Filename; FilePath... via API. I often do it with iLogic with simple code:

ThisDoc.Path
ThisDoc.FileName(False) 'without Extension
ThisDoc.PathAndFileName(False)

but with API I don't know how. Please help me an idea. Thanks!

 

0 Likes
Reply
Accepted solutions (1)
371 Views
3 Replies
Replies (3)

WCrihfield
Mentor
Mentor
Accepted solution

Here are some lines of code that you can use for that sort of thing.

Dim oDoc As Document = ThisApplication.ActiveDocument
Dim oPath As String = System.IO.Path.GetDirectoryName(oDoc.FullFileName)
Dim oName As String = System.IO.Path.GetFileNameWithoutExtension(oDoc.FullFileName)
Dim oNameAndExt As String = System.IO.Path.GetFileName(oDoc.FullFileName)
Dim oExt As String = System.IO.Path.GetExtension(oDoc.FullFileName)

If this solved your problem, or answered your question, please click ACCEPT SOLUTION .
Or, if this helped you, please click (LIKE or KUDOS) :thumbs_up:.

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

ngnam1988
Advocate
Advocate
I got it. Thanks!
0 Likes

WCrihfield
Mentor
Mentor

Hi @ngnam1988.  Glad I was able to help out some.

By the way, here are a few related links you might find helpful, on the same general subject.

https://knowledge.autodesk.com/community/article/401261 

https://knowledge.autodesk.com/community/article/353376 

https://knowledge.autodesk.com/community/article/408641 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)