Question

My Goal: Create a program which can copy a sharepoint database daily to an SQL server. It should run from a server, and it should run daily.

Current Status: The sharepoint website is linked to a local copy of an accessDB file type accdb I open it with OleDB and the program runs locally generating the tables/columns/datatypes and copying the data.

Problem: When I take my solution and try to deploy it to a remote server it has a popup window asking for the user in the segment of code which opens the accessDB. I need this window to die. The process must be automatic so it obviously cannot require human input to run.

I have spent the better part of a day trying to get this thing to go away and the program to run without it. No luck with google, StackOverflow, connectionstrings.com, or MSDN and a lot of other random websites.


Relevant code:

     public void openDataFromAccess(string connectionString, string tableName, string connectionString2)
     {            
        string sqlQuery = "SELECT * from [" + tableName +"]";
        try
        {
            using (DataTable dt = new DataTable())
            {
                using (OleDbConnection conn = new OleDbConnection(connectionString))
                using (OleDbCommand cmd = new OleDbCommand(sqlQuery, conn))
                using (OleDbDataAdapter adapter = new OleDbDataAdapter(cmd))
                {
                    cmd.CommandType = CommandType.Text;
                    cmd.Connection.Open();
                    adapter.SelectCommand.CommandTimeout = 240;
                    adapter.Fill(dt);
                    adapter.Dispose();
                }

The default connection string:

    string connectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Migration\Sharepoint Access SQL Batch Job\Database2.accdb;Jet OLEDB:Database Password=password";

Things I have tried include:

   User Id=userid;Password=pass
   Persist Security Info=False;
   Delay Validation=TRUE
   Integrated Security=true;  
   Mode=Read;

and every other setting I could find in connection strings to no avail.


The popup has a save information setting but I would rather it be in the program, but the window does not save the passwork when I type it in manually but it does run. I cannot seem to get it to accept a hardcoded value??? Restarting the server and starting the service for Credential Manager and the registry editor does not help.

When I try to hardcode a user various errors occur such as:

"The workgroup information file is missing or opened exclusivly by another program"

The user is not certified or some similar message like that (when the user should be, and I have tried several users and creating new users and admins etc. being very very careful to type it in as I thought was correctly) I have tried to edit the sharepoint admins but in my access when I try to edit permissions it links me to the sharepoint.

There is no JET registry I had to install the AccessDataBaseEngine_x64 manually. The program did not run on the server before this.

I am fairly sure the solution will be simple but what I have tried so far has not worked.

Ideas???

Was it helpful?

Solution

The project was canceled so no solution necessary.

The database has some issues with authentication and this method does not support passing a specific user it seems, so I would throw it out and try using a sharepoint virtual server or some other method. I also hear the newer libraries will support sharepoint better.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top