Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

sharepoint 2010 query external list programmatically + Attempted to perform an unauthorized operation.

$
0
0

Hi All,

 i have an external list which is get data from simple SQL table. while viewing the External list work fine. but when i am trying to retrieve the data by CAML Problematically i am getting error 'Attempted to perform an unauthorized operation' .

                    using (SPSite oSite = new SPSite("Site Address"))
                    {
                        using (SPWeb oWeb = oSite.OpenWeb())
                        {

                            SPList oList = oWeb.Lists.TryGetList("External_List_To_test_Linq");
                            SPQuery oQuery = new SPQuery();
                            string camlquery = @"<Where><Eq><FieldRef Name='ID'/><Value Type='Text'>1</Value></Eq></Where>";
                            oQuery.Query = camlquery;

                            SPListItemCollection listItemCollection = oList.GetItems(oQuery);
                            foreach (SPListItem oitem in listItemCollection)
                            {
                                Console.WriteLine("ID" + oitem);
                            }

                        }
                    }

I am getting error while Reading the ID. it says 'Attempted to perform an unauthorized operation'.


Thanks and Regards

Er.Pradipta Nayak
Visit my Blog
Xchanging


Viewing all articles
Browse latest Browse all 11571

Trending Articles



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