Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have some documents in a document library in SharePoint 2007. The URL is http://abcd:24931/docu/Forms/AllItems.aspx.

I need to display these documents in a data grid view of a Windows form application. I've written:

SPSite siteurl = new SPSite("http://abcd:24931/docu/Forms/AllItems.aspx");

But here (while debugging) the siteurl object does not contain the above complete URL. It only contains http://abcd:24931.

This is my big problem, please provide a solution for my code.

share|improve this question
add comment

1 Answer 1

You cannot take a document library's full url into a new SPSite object, that object can only take in a url to a SiteCollection.

What you can do, is getnan SPList instance of your document library then use the .Site property to get the SPSite object you want.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.