Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Access violation - access list by code

$
0
0

I have the following code in a windows form application to access a SharePoint list. I have full access to the site collection and the list. However, I got "-1073741819 (0xc0000005) 'Access violation' error when the code tried to access the list. I have tried it with different list and got the same result.

using (SPSite oSPsite = new SPSite("http://localhost/"))

{

           using (SPWeb oSPWeb = oSPsite.OpenWeb())

           {                   

                   SPList aList = oSPWeb.GetList("BTU");

                   

            }

}

Please advise if you know what is my problem. Many thanks. 


Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>