Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Type 'SPSite' is not defined

Status
Not open for further replies.

thankgodfortektips

Programmer
Joined
Dec 20, 2005
Messages
95
Location
KY
Hi all,

I am trying to automatically create a document library in Sharepoint. I have been given the below code and been told that it will work once the microsoft.sharepoint.dll file is put in the assembly folder.

It is on Server03 with IIS 6.

I have the following code...
********************************************************
<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%
Dim url As String
url = "Dim site As New SPSite(url)
Dim web As New SPWeb
web = site.OpenWeb()
Dim g As Guid
g = web.Lists.Add("MWMH", "MWMHDescription", SPListTemplateType.DocumentLibrary)
%>

<html>
<head>
<title>Create Doc Lib</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>

</body>
</html>
*********************************************************

which is giving me the following error:
*********************************************************
Server Error in '/' Application.
--------------------------------------------------------------------------------

Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: BC30002: Type 'SPSite' is not defined.

Source Error:



Line 4: Dim url As String
Line 5: url = "Line 6: Dim site As New SPSite(url)
Line 7: Dim web As New SPWeb
Line 8: web = site.OpenWeb()
***********************************************************

Thanks in advance guys!!!
 
thankgod - just dropping in for a hip shot on this as no one has tackled it - there is probably one or two who may be getting more information on this -- the error suggests that SPSite(url) isn't recognized - that tells me (as a technical user so only a hunch here) that something is missing in the page registration section at the top of the page. Are you sure that is complete. The point being whenever I see or encouter this error it winds up being a missing item in the registration area at the top of the page. Just a thought. My guess is that your problem is simple enough just have to identry the reason SPSite is "unknonwn".
 
set the page directive to import Microsoft.SharePoint too

<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" %>
...
<%@ Import Namespace="Microsoft.SharePoint" %>

???
 
adamroof - I agree - it seems there is a missing directive.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top