.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Can not access SharePoint Lists from ASP.NET web application

Posted By:      Posted Date: October 11, 2010    Points: 0   Category :SharePoint


I don't know if this is the right place for this but is related to SharePoint.

using (SPSite site = new SPSite("http://server/siteName/"))
       if (site != null)
         using (SPWeb web = site.OpenWeb())
           foreach (SPList myList in web.Lists)


Example this code above:

I connected remotelly on the server, and in VS 2010 created a new ASP.NET Web Site. Added a new .aspx page and in code behind in the Page_Load event handler i put the code above. (lbLists is a ListBox on the .aspx page).

When i run this page and try to see the results in browser it doesen't work!!

The same code works perfectly on a windows form application!! What is the reason why it is not working?

It ment to not work? How can i make a web application (ASP.NET) that i can access a SharePoint site programmatically and display the items?

Then i want to deploy this app and run it in browser.


View Complete Post

More Related Resource Links

Video: The Access Show: Client Performance Improvements against SharePoint Lists

Today's guest is DJ Cole, architect and primary developer of SharePoint connectivity performance improvements on the Access development team. DJ dropped by to talk about how Access 2010 connects to SharePoint, and to discuss the work necessary for improving client-side performance. (Length: 13:05)

Problems with access to external lists in SharePoint 2010

Our environment is SharePoint 2010 Enterprise, Windows Server 2008 R2 Standard and SQL server 2008 R2.   We have External lists that access a local database in SharePoint SQL Server. When new lists are added and permissions are given in the SharePoint Central Administration the domain users had to be in the Windows administration group to access the lists.   Recently in the same environment the domain users were removed from Windows Administration user group and could access the external lists.   In another similar test server we found adding the domain users to Windows Administration does not give the new domain users access to External lists.   The inconsistency is the issue. Has anyone seen this issue or provide a possible solution?

Is SharePoint and Access 2010 the right platform for subscription based web application?



I posted a similar question in the Access Form and the MVP's there suggested I post a follow up here, to clarify the SharePoint issue. 

My Question: is SharePoint and Access 2010 a good platform, or can it do what I need?

The Scenario:

I currently have a client/server app built in Access 2002 with many clients in a single industry. My clients are very mobile and would like to be able to do their work in the app anywhere, not just while connected to the office network. Likewise, a large percentage in that industry have Macs (I've used Windows in Parallels or Fusion for these clients but it's not a smooth process, in a lot of 'connectivity' ways). My clients are asking, and my competition already has, web based applications. I very much need to get my app on the web. Along with that, I need to set it up as a monthly subscription based application.


So I'm hoping Access and SharePoint can do this. I don't know ASP or PHP or SQL so it'd be a steep learning curve if I have to go that route. I don't know much about SharePoint but have watched videos about using it for Access Web databases as well as RichClient/SharePoint Lists. 

It's possible I could have over 1000 clients, each of which will have a few thousand records in the main few tables (SP Lists). Each client could also have several users l

Silverlight access SharePoint Workspace offline lists


Is it possible to access SharePoint Workspace data from a silverlight out-of-browser application?

We need to have data offline and be able to sync it back later on. Data is stored in external lists and we want to be able to read and write to the external lists offline from a more user friendly GUI such as a Silverlight application. Infopath forms can not do the advanced GUI things we want to do, therefore it is not an option.

Access SharePoint COM from ASP.NET Web Application



I have a big issue in accessing a SharePoint site from ASP.NET Web Application.

Console code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;

namespace ConsoleApplication1
  class Program
    static void Main(string[] args)
      using (SPSite site = new SPSite("http://server/site"))
        using (SPWeb web = site.OpenWeb())

          foreach (SPList myList in web.Lists)


This code is a console app that will display all the lists from that site. Works fine, no problem!

System Info: Windows Server 2008 R2, SharePoint Server 2010, SQL Server 2008 R2. My user has admin rights everywere.

Now I created a new ASP.NET Web Application project, .NET Framework 3.5, AnyCPU (and I use Visual Studio Development Server, not deployed yet)

On the default.aspx page I added: one ListBox and a Button.

Event handler for Button Click code is the same as the code above, a simple thing to display all lists from a site.

Result: is not working!

Are there issues in developing ASP.NET Web Application that uses SharePoint Client Object Model?

I just want to

Access denied when Searc Service Application tries to crawl Sharepoint content


I have just set up a new SP2010 environtment(3 servers: WFE, App, SQL).

When I try to get my Search Service Application to crawl my main SP site and my MySite location, I get the following error in the crawl log:

"Access is denied. Verify that either the Default Content Access Account has access to this repository, or add a crawl rule to crawl this repository. If the repository being crawled is a SharePoint repository, verify that the account you are using has "Full Read" permissions on the SharePoint Web Application being crawled."

Things I have checked:
I have ensured that the default access account has "Full Read" on the web application
-I set up crawl rules for both sources specifying a service account that has admin access to the content on those sites
-I logged in to the SP sites using the service account that the Service Application is using to crawl
-I even created a brand new search service application from scratch and got the exact same results

The only difference between this environment and my test environment, where search works just fine, is that this is the production environment and so it uses FQDN with a host header: http://portal.company.org.


Sharepoint 2010 - Lists not displaying Edit (Link to item) for Users with Edit Only access



I am using Sharepoint 2010.  I have several lists whose view includes the column "Edit (Link to Item)" in the default view.  I am the site admin so when I view the list the "Edit" column appears with the small "paper and pencil" icon and it works when clicked. 

I needed some users to only be able to view and edit existing items (not add or delete).  So I have created a site level permissions that I copied from "Read" and only checked the "Edit Items  -  Edit items in lists, edit documents in document libraries, and customize Web Part Pages in document libraries" under Lists. 

This new permission level does allow users to see the edit menu item on the standard "Title" hyperlink dropdown, but in the"Edit" column there isn't an icon or any clickable link to edit in the column.  Only from the menu.  Its as if the icon won't appear if I don't give them Add capability which is what I don't want.

 Thanks for any tips,






How to open More then one lists of sharepoint 2010 as a tables in access 2010 data base


Hi  friends  this is siddiq ,

                                   How can i open sharepoint 2010 lists in access 2010 as tables in 1 data base.I have 2 lists which i want to take into access but both of the lists are creating a seperate  database.But i want to take  both the lists  in one access database 

Mohammad Siddiqali

problem in applying SharePoint Designer Workflows to Lists in my Web application


Hi Mark,

I am so happy finding your forum.

I have installed MOSS 2007 with SP2 on a Windows Server 2008. I had no problem in configuring and creating Web Applications and Sites. However, there seems to be a problem in applying SharePoint Designer Workflows to Lists in my Web application. The problem is that the workflow I create to start automatically when an item in the List is changed doesn't work. The workflows works fine if it's started manually from an item in the list, but it's doesn’t work when it's started automatically with an item change in the list. I have checked the workflow on another MOSS 2007 installation on Server 2003 and it works fine. Have I missed something in the configurations?

Thanks for y

Video: Access Multiple SharePoint 2010 Lists by Using LINQ

Learn to create SharePoint 2010 Web Parts that query multiple lists by using LINQ.

Cannot access Sharepoint List using Lists.asmx webservice

var a = new ActiveXObject("Microsoft.XMLHTTP");
a.setRequestHeader("Content-Type", "text/xml;charset=utf-8");
a.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/sharepoint/soap/GetListItems");

var d = "<?xml version='1.0' encoding='utf-8'?><soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:tns='http://schemas.microsoft.com/sharepoint/soap/'><soap:Body><tns:GetListItems><tns:listName>

attach access database in SharePoint 2010 service application


I am planing to publish Access database MyDB into Access Service application in SharePoint 2010 server farm. MyDB has following tables,

tblShared1, tblShared2, tblShared3, tblShared4, ... 

Is that possible for each user to open an Access database locally and set linked tables above in MyDB Access database? If yes, how it works?

Thanks in advance,    

Displaying SharePoint lists in Web Parts

When you create a built-in or custom list in Microsoft Windows SharePoint Services, Windows SharePoint Services creates a Web Part, a basic building block of a SharePoint site, to display that list. These Web Parts are called List View Web Parts. Windows SharePoint Services stores List View Web Parts in the site collection Web Part gallery. (The site collection Web Part gallery is the most central gallery of Web Parts for a work group. By default, the gallery name is the name of the site, such as "Our Team Site Web Part Gallery." )

SharePoint Tutorial - Lists

A list is a feature in SharePoint that stores a lists of information. For example, a list can be created to store web links in the human resources team site. A list is usually created for a specific type of information. Lists can contain metadata to describe the particular information in more detail and to make it easier to find.

Integrating a Legacy Web Application in SharePoint

This month we will continue with the theme of deploying Microsoft's SharePoint as a company intranet by describing a method for integrating a legacy Web application inside a SharePoint site.

In many companies the intranet site is not just a home page with announcements. It houses Web applications used by many different departments. In last month's article, I built a page to search the employee table in Northwind (the sample database included in Microsoft's SQL Server). This month, I will move the Web pages used to add/remove records from the table into the SharePoint intranet.

MVC architecture in ASP.Net using C# and Microsoft Data Access Application block

The Model-View-Controller (MVC) pattern separates the modeling of the domain, the presentation, and the actions based on user input into three separate classes [Burbeck92]:

Model. The model manages the behavior and data of the application domain, responds to requests for information about its state (usually from the view), and responds to instructions to change state (usually from the controller).

View. The view manages the display of information.

Controller. The controller interprets the mouse and keyboard inputs from the user, informing the model and/or the view to change as appropriate.

SharePoint Application and Site Pages - Part 1 of 2

In this first part of the two part series, Steven covers the differences between Site and Application pages in SharePoint 2007, why each may be used in various circumstances, and prepares for the construction of a menu located application page. After a brief introduction he examines the concept of Site Pages and Application Pages separately in detail with supported screenshots.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend