Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8388795
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T18:33:00+00:00 2026-06-09T18:33:00+00:00

I have to build a software which can search and display PDF files from

  • 0

I have to build a software which can search and display PDF files from a folder on the local network.
My supervisor was requesting to have a database and store the path of PDF files there(not to the PDF itself because of the large amount), so I can search and open them from the software.

I would greatly appreciate if you could give me some ideas for solving it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T18:33:01+00:00Added an answer on June 9, 2026 at 6:33 pm
        private string[,] GetImagesFromServerFolder()
        {
            IntPtr token;
            if (
                !NativeMethods.LogonUser([Server_Login_Name], [Server_Location],
                                         [Server_Login_Password], NativeMethods.LogonType.NewCredentials,
                                         NativeMethods.LogonProvider.Default, out token))
            {
                throw new Win32Exception();
            }
    
            try
            {
                IntPtr tokenDuplicate;
    
                if (!NativeMethods.DuplicateToken(
                    token,
                    NativeMethods.SecurityImpersonationLevel.Impersonation,
                    out tokenDuplicate))
                {
                    throw new Win32Exception();
                }
    
                try
                {
                    using (WindowsImpersonationContext impersonationContext =
                        new WindowsIdentity(tokenDuplicate).Impersonate())
                    {
                        /******************* CODE FROM HERE *******************/
    
                        List<string> files = new List<string>(Directory.GetFiles(_PHYSICAL SERVER LOCATION_));
    
    
                        return files;
    
                        /******************* CODE TO HERE *******************/
                    }
                }
                finally
                {
                    if (tokenDuplicate != IntPtr.Zero)
                    {
                        if (!NativeMethods.CloseHandle(tokenDuplicate))
                        {
                            // Uncomment if you need to know this case.
                            ////throw new Win32Exception();
                        }
                    }
                }
            }
            finally
            {
                if (token != IntPtr.Zero)
                {
                    if (!NativeMethods.CloseHandle(token))
                    {
                        // Uncomment if you need to know this case.
                        ////throw new Win32Exception();
                    }
                }
            }
        }  
    

    This will then return a list of all the .pdf files and locations
    You can then sore that in a DB.

    Then, run through all the files in the list (In your main running method);

    List<string> file = GetImagesFromServerFolder();  
    foreach (var s in file)  
    {  
            const string connStr = "INSERT INTO tblPdfLocations (location) VALUES (@location)";
            //Store the connection details as a string
        string connstr =
            String.Format(@"SERVER=[LOCATION]; UID=[USERNAME]; pwd=[PASSWORD]; Database=[DATABASE]");
    
        //Initialise the connection to the server using the connection string.
        _sqlConn = new SqlConnection(connstr);
    
            var sqlComm = new SqlCommand(connStr, _sqlConn) {CommandType = CommandType.Text};
            sqlComm.Parameters.Add(new SqlParameter("@location", SqlDbType.VarChar, 50)).Value = s;
    
            sqlComm.ExecuteNonQuery();
            _sqlConn.Close();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a piece of unix software written in C++ which can be build
I have an assembly which generates a Form (it is a client-software). I can
I have created a TFS build definition to create our software releases. Now I
I have build a webapplication using ASP.NET MVC and JQuery. On my local machine
I have a Nant build script which referrences 30 other build scripts. Each build
I have familiarities with software automated build tools ( such as Automated Build Studio).
i have to develop desktop base software in C#.Net which only produces reports and
I Have a 3rd Party component ArchestrA.MxAccess.dll (which is build on x86 by corgflags)
I have planned to develop lead tracking software for our business which involves Customer
So I have created a piece of software which I wanna package and post

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.