Accessing Document Library from the code using UNC path RRS feed

  • Question


    I tried to access an excel file placed in sharepoint document library using  UNC path as  you can see in my sample code below, and it works  only on my local test project (i.e only in the webapplication project). But when I deployed it into Sharepoint, it did not work! It gives me error “The Microsoft Office Access database engine cannot open or write to the file ''. It is already opened exclusively by another user, or you need permission to view and write its data.”

      I do not want to use Excel services, becuae it has many limitations.


          Dim connString As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\\myShrSite\TestDocList\tstExlJet.xlsx;Extended Properties=Excel 12.0"



            Dim oledbConn As OleDbConnection = New OleDbConnection(connString)




            Dim cmd As OleDbCommand = New OleDbCommand("SELECT * FROM [Student Info$] Where [Grade] > 60", oledbConn)


            Dim oleda As New OleDbDataAdapter()


            oleda.SelectCommand = cmd


            Dim dt As New DataTable




            grid1.DataSource = dt



    • Moved by Wayne Fan Friday, July 16, 2010 1:44 AM issue (From:SharePoint - Development and Programming (pre-SharePoint 2010))
    Thursday, July 8, 2010 8:25 AM

All replies

  • Hi,

    Is the SharePoint Document Library configured to require a Check Out of the document?


    Cathy Miller

    Microsoft Online Community Support

    Wednesday, July 21, 2010 7:56 PM