.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

Linq to SharePoint - connect to specific site collection

Posted By:      Posted Date: April 14, 2011    Points: 0   Category :C#

I have a site collection at http://[server]:[port]/sites/[name].  When I try to execute a linq query I get an exception saying that the web at http://[server]:[port]/sites/[name] cannot be found.  If I pass http://[server]:[port] to the datacontext that web is found, but the SPList I am trying to query cannot be found.

From looking online I know you cannot (without workarounds) query cross site collections, but I don't want to do that.  How do I connect to the specific site collection at http://[server]:[port]/sites/[name] with linq to sharepoint?

Need to add that I am using linq to sharepoint in an aspx web app that is running on the SharePoint server.

View Complete Post

More Related Resource Links

Video: Site Collection Solution Galleries in SharePoint 2010

This demonstration shows the solution gallery and solution management features of SharePoint 2010. (Length: 4:01)

User Alert Management for a specific list versus entire SharePoint site?

It seems that to be able to manage User Alerts, one must have Full Access to the entire SharePoint site - and then use => Site Settings > User Alerts. Ideally, I would like to be able to grant access to users to only be able to manage alerts for a specific list. Is this possible (without having to do any programming) and, if so, how? If such access is only available at the site level, I will simply create a Permission Level that allows one to only "Manage Alerts" Thanks in advance for any assistance. Dave

SharePoint Search not working on one site collection

I am running into some weird behavior with how SharePoint is crawling site/list data.  Let's say our main intranet site is http://www.intranet.com: Most of our older sites are setup with URLs like http://www.intranet.com/sites/sitename .  Crawling is working fine on these sites and I can execute a search and find all of the results I would expect.  At some point recently (before I joined this firm), they made a decision that all new sites would have the URL http://www.intranet.com/SiteDirectory/sitename .  Any sites which fall into this bucket are not being crawled, it would seem. If I check Central Adman>Shared Services>Search Administration, I can see that the first content source being crawled is http://www.intranet.com so I would imagine this crawl should pick up anything under /SiteDirectory/ but it is not.  I also checked the Crawl Settings on this page and it is set to "Crawl everything under the hostname for each start address".  Lastly, I see that there were only 21 errors in the last full crawl but none of these errors apply to a /SiteDirectory/ site. In short, what could be causing the crawl to apparently skip all of the sites within /SiteDirectory/ and how can this best be fixed?

How to add Site Collection Auditor role to a specific site collection

Hi All, I want to add Site Collection Auditor role to a user at the SiteCollection level. Is there a way to do this. I don't want to add the user at the Web Application Policy level which has this option.   Thanks Carol

SharePoint 2010 new site collection display blank page

I'm using Windows Vista SP2 and trying to learn Sharepoint 2010. I'm new to Sharepoint and I'm sorry if I'm asking something very simple. I've successfully installed Sharepoint foundation 2010 and VS 2010. According to the installation instruction if the installation is successful I should see the new sharepoint website home page or ask for login info which will take to the home page. But for me it displayed a blank web page. I was able to get to Sharepoint Central administration page by clicking the browse option from IIS, it asked me login info and when I provided that I was able to see the Sharepoint central administration page. Now I am trying to create a new site collection, it is succesfully creating the new site collection and showing the link, but when I access the link I see a blank webpage. I think it is some permission issue and if the program prompts login, it should work, but how can I get to the login window or how can I see the home page and not a blank page? Thanks

Office Sharepoint Server Publishing Infrastructure is missing in site collection feature SharePoint

I was trying to activate the Office Sharepoint Server Publishing Infrastructure feature in the site collection features but the feature is simply not there. Is this option not available in SharePoint Foundation 2010?

Unable To Connect Database Error:Sharepoint 2007 Internet Site.

Hi Techies,  we are running 4farm Sharepoint internet site. now a days we are getting the below error very regularly. Event Viewer :The description for Event ID ( 27745 ) in Source ( Windows SharePoint Services 3 ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. You may be able to use the /AUXSOURCE= flag to retrieve this description; see Help and Support for details. The following information is part of the event: #50071: Unable to connect to the database SharePoint_Config on SPPREPROD02VMDK\SPPREDPROD.  Check the database connection information and make sure that the database server is running.. Sharepoint Logs:#50071 :#50071: Unable to connect to the database SharePoint_Config on pfc-penndb-tst. Check the database connection information and make sure that the database server is running.. Please Advice . Regards, raju.  Nag: http://nagaraju-sharepoint.blogspot.com. Posting is provided with no warranties.

Cannot connect SharePoint 2010 site with Office 2010 beta

I installed Office 2010 beta, then want to new a workspace of SharePoint 2010 beta. An error pop-up: SharePoint workspace cannot sync with the specified SharePoint site because its server version is not supported.My SharePoint 2010 beta is the only web front end server in a farm environment. I started all the SharePoint related services, but the error pop-up anyway...

How to connect 2 Lists Sharepoint site through Designer

Hello to all I am siddiqali new to sharepoint 2010,I want to know how can i connect 2 lists in sharepoint 2010 without using code ,look ups and visual webpart. I am guessing that it can be posibble through designer,but as i am new to sharepoint i am not able to do it  Example If in 1 list student number,name,class,section is existed ,In other list if we enter student number in text box we should get the student information   Thank You, MD.SIDDIQALI

Moving a larger Sharepoint 2007 site collection over to a new server



We have a Sharepoint 2007 site collection roughly 36 GB in size and have been having problems moving the site to a new server farm (Also 2007). We are trying the Sharepoint backup and restore method, but I understand that this method is not recommended for sites over 5GB. Has anyone moved a site of this size and how did you do it?

Thanks  Ron


can we use one SharePoint list throughout the site collection?


hi all,

I want to use one list which should be accessible with in the SiteCollection. When I am Creating the List it is available in that purticular site only but i want to use the in all the sites in the siteCollection. So Please tell me how we can use a list in all the sites of the Site Collection?

thanks in advance.................

Maximum number of Document libraries or Lists that can be created in a Site collection of sharepoint


Hello Guys, 

what is the maximum limit for creating document libraries in sharepoint 2010, is there any limit? if so can you give me the number and details where do i find it.

Thanks in advance.

cannot connect to sharepoint server intranet site through VPN with windows vista home premium 64bit

Hi, a company i work for has an intranet site using sharepoint 2008. i can connect to the intranet remotely through their vpn however i am not able to view the instranet site or ping the server it is on...

does anyone have any ideas on whether this might be a vista issue or ????


how to use root site collection spurl in css stylesheet in sharepoint 2010


how to use root site collection spurl in css stylesheet in sharepoint 2010

I want to give image url and all images reside in sitecollection images folder and url should be given from css and not from actual page layout using spurl.

How to use spurl tag in css. I tried it  $SPUrl:~sitecollection/Sitecollectionimages/ in css file but it does not work. It works from actual page layout.

Is it possible to remove 'SharePoint Designer Settings' link from Site collection Adminitration Se

Is it possible to remove the link 'SharePoint Designer Settings' from the Site Collection Administration section of settings page.

How to create a new site collection in Sharepoint 2010?



How to create a new site collection in Sharepoint 2010 from Central Administration ?

Programmatically activate SharePoint Server Enterprise Site Collection features


As my solution requires the enterprise features I'm required to activate them. Right now I'm doing it manually through "site settings -> site collection features", but I want to do it automatically when activating an other part of my solution. I've used PowerShell to see the difference for "Get-SPFeature -site myurl" before and after activating the enterprise feature by hand, but there're at least 10 site collection features being activated through this one click step.

Is there a list of features which are part of the SharePoint Server Enterprise Site Collection features or is there an easier way to activate them all at a time instead of doing it one by one programmatically.

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