rcdodd | Posts: 3

How to retrieve file name of a document?

0 votes
Hello! I need to be able to pull down the name of the file that was uploaded with a document in a given package. I see that there is a "FileName" property on the "Document" object, but when I pull a package down and loop through its documents, the FileName is always null. Any assistance would be greatly appreciated! I was directed to this forum from Support. Thanks!

harishaidary | Posts: 1812

Reply to: How to retrieve file name of a document?

0 votes
Hey, The sample code below will show you how to retrieve the document names in a package. The first step is to retrieve the package. Once you have it, you need to loop through the list and print out the document names. Let me know if it helps.
 public static void Main(string[] args)
        {
            string apiKey = "your_api_key";
            string url = "https://sandbox.esignlive.com/api";

            EslClient esl = new EslClient(apiKey, url);

            PackageId packageId = new PackageId("d9355f04-9bb2-4219-b9fa-734f2650a939");
            DocumentPackage package = esl.GetPackage(packageId);

            IList documentsHistory = package.Documents;

            for (int i = 0; i  documentsHistory.Count; i++){
        	Debug.WriteLine("Document "+ i +" "+documentsHistory[i].Name);
            }

rcdodd | Posts: 3

Reply to: How to retrieve file name of a document?

0 votes
Haris, Thank you, but I have no problems getting at the "Name" property. There is a similar property on that object, called "FileName" --- that is the one I am interested in. It is always null.
 for (int i = 0; i  documentsHistory.Count; i++){
        	Debug.WriteLine("Document "+ i +" "+documentsHistory[i].FileName);
            }

harishaidary | Posts: 1812

Reply to: How to retrieve file name of a document?

0 votes
Do you require something else that "documentsHistory[i].Name" doesn't give?

rcdodd | Posts: 3

Reply to: How to retrieve file name of a document?

0 votes
I need the name of the file that was uploaded, not the title of the document. For example: documentsHistory[i].Name == "Power of Attorney Form" documentsHistory[i].FileName == "poa.doc" ----- THIS is the property I'm asking about. This is always null.

Hello! Looks like you're enjoying the discussion, but haven't signed up for an account.

When you create an account, we remember exactly what you've read, so you always come right back where you left off