Sharepoint running notes

sp isuues

1. exited with code 1

3. REmove installstate file because there are no installers.

installutil /u [path of exe]

 ie f:/samples/mcWIndowsService/bin/debug/mcWindowsService.exe

installutil [path of exe]

 ie f:/samples/mcWIndowsService/bin/debug/mcWindowsService.exe
Timer control : windows application windows.form timer control should nt be used for windows service.
in runtime use System.Timer

in window service add installers.

Confusion in this : Add Reference: Windows sharepoint services .. see its name Microsoft.Sharepoint.dll


how to debug windows service?

attach to win service that u have created
6. How to get central administration url
Web frond end servers

hkey_local_machine\software\microsoft\shared tools\web server extensions\12.0\wss

1.  website –> site collection –> sites

2. 2003 –> 60 folder
   2007 –> 12 folder

( {os installtion drive}: \Program Files\Common Files\Microsoft Shared\web server extensions\12\)


Default databases:

if u create webapplication

for sharedservices:

WSS 3.0 has added a valuable new innovation known as the site column. A site column is a reusable column definition that can be used across multiple lists.

Another great new development opportunity is to work with the new Office Open XML file formats. This new technology introduced with Microsoft Office 2007 provides you with the ability to generate and/or manipulate Microsoft Office Word documents and Microsoft Office Excel documents from server-side code within custom components such as event handlers and workflows.

WSS 3.0 adds a second powerful innovation focused on content storage. It is known as a content type. A content type is a flexible and reusable WSS type definition that defines the columns and behavior for an item in a list or a document in a document library.

 Features are a new developer-focused innovation that has been added to WSS 3.0. Features provide a mechanism for defining site elements and adding them to a target site or site collection through a process known as feature activation. The element types that can be defined by a feature include menu commands, link commands, page templates, page instances, list definitions, list instances, event handlers, and workflows.
  User profiles are in ssp

List created in one site . How to download and upload in another site

Go to Site Actions -> SiteSettings -> List Templates
These virtual directories, including the _controltemplates directory, the _layouts directory, the _vti_bin directory, and the _wpresources directory,

Each of these virtual directories plays a special role in the overall WSS architecture. For example, the _vit_bin directory provides WSS with a way to expose DLLs and .asmx Web service files at a path within the URL space of a Web application. The _controltemplates directory provides a dedicated repository for deploying ASP.NET user controls that can be used within pages. The _wpresources virtual directory provides a repository for resource files that are deployed along with Web Parts.

The one virtual directory of a Web application that we want to discuss in greater depth in this chapter is the _layouts directory because it provides the foundation for a special type of page known as an application page. Application pages are served up from the _layouts directory
8. Install Infopath

Design Checker and Data Source are required.
Enable browser to open checkbox

go that doclibrary

 settings –>Form Library Settings –> Advanced Settings -> Display as a web page.

tools –> Form options –>Compatibility –> infopath on browser
tools– > submit options
Web Part Manager control
Web Part zones
dynamic SharePoint site model, templating framework, security framework, and Web Part management using the WSS Web Part Gallery

System.Web.UI.WebControls.WebParts.WebPart  wss 3.0
Microsoft.SharePoint.WebPartPages.WebPart    wss 2.0

override the RenderContents method
Web Parts for SharePoint deployment derive from the System.Web.UI.WebParts.WebPart class. Although in ASP.NET 2.0 you can add a User Control (.ascx file) as a Web Part (using the GenericWebPart wrapper), the GenericWebPart is not deployable to SharePoint. Therefore, SharePoint is more restrictive than ASP.NET 2.0 in that you cannot directly use User Controls as Web Parts. Instead, you must use an indirect technique in which you write wrapper Web Parts to dynamically load and host User Controls. Read about the Smart Part ( made famous by Jan Tielens
There are a few methods that are crucial to understand in the control life cycle. OnLoad is used to initialize the control but is not intended for loading data or other processing functionality. OnPreRender is used to initiate any long-running processes such as database retrieval or Web service calls by initiating asynchronous calls. The Page class also fires a PreRenderComplete event after all of the page’s prerender tasks are completed. If you are using controls for your display, the only method you’ll need to implement for UI components is CreateChildControls. Controls added to the controls collection of the Web control will render from the framework, and so there is typically no need to override any render methods unless you need to directly use the HtmlTextWriter class. If you do need to render your own controls, you can do so in the RenderContents method, which will get rendered inside of the Web control chrome. You may want to render your own controls in order to display them in a table or other HTML layout. To receive postback data from an included control, you will need to create a private reference of your control and create it in the CreateChildControls method. Before accessing the control, you can ensure it is created by first calling the EnsureChildControls method. Table 4-1 lists the Web Part life cycle in general order of execution, including the standard methods and events to use when building Web Parts. There are some methods, however, that are not guaranteed to execute in order. These include CreateChildControls, EnsureChildControls, and methods marked with the ConnectionConsumer and ConnectionProvider attributes. Before accessing the properties of any composite controls, the EnsureChildControls method must be called to prevent null reference exceptions.
To use the SharePoint site object model (including security and authorization), add a reference to the primary WSS assembly Microsoft .SharePoint.dll and Microsoft.SharePoint.Security.dll. To deploy your Web Part assembly with a strong name to the bin directory, you will also need to include the assembly attribute AllowPartiallyTrustedCallers. This attribute must be included once in the assembly and is typically included in the AssemblyInfo code file.

[assembly: System.Security.AllowPartiallyTrustedCallers]

Program on webpart
create c# classlibrary
give reference system.web
override createchildcontrol
build the solution
keep the dll in wwwroot\wss\virtualdirectories\[applicatin]\bin folder
add safecontrol tag to web.config of wwwroot application .

   <SafeControl Assembly=”JagWebpart” Namespace=”JagWebpart”  TypeName=”*” Safe=”True” />

Go to http://prodsk0657:26068/_catalogs/wp/Forms/AllItems.aspx

After adding the SafeControls entry, the next step is to test your Web Part by adding it to the gallery and a Web Part page. There are many ways to deploy a Web Part, but during development you will do this manually most of the time. To add your Web Part to the gallery, navigate to the following URL on your WSS site: http://localhost/_catalogs/wp. This gallery is also available from each top level site’s Site Settings page. From this gallery, click the New button to get to the page http://localhost/_layouts/NewDwp.aspx. This page will list all Web Parts that are available either in the bin directory or global assembly cache and that are registered in this Web application’s Safe Controls entries. If you don’t see your Web Part on this page, take some time to troubleshoot. For example, ensure that your Web Part is public, derives from the WebPart class, is correctly registered as safe with the full namespace and proper assembly name, and is deployed to the right directory. If your Web Part assembly is signed, be sure that the correct strong name is referenced in the SafeControls entry. Figure 4-4 displays the new Web Part page where you can create Web Part Gallery entries using the Web interface.
When you select a Web Part on the New Web Parts page and click the Populate Gallery button, WSS generates a new entry in the site collection’s Web Part Gallery. After this, the Web Part will be available to all page,, and you can access it with the Add A Web Part option from the Edit Page command. After the Web Part is added to the page,

 new concepts like content types and Features


In Windows SharePoint Services 3.0, there are three fundamental ways to register an event handler:

Through the object model, as the SPWeb and SPList classes now each provide an EventReceivers property through which to access the collection of event receiver definitions for the Web site or list. You can add new event receivers by calling the Add method.

Declaratively by list type, for example, to register an event handler for all announcements lists. In a Feature.xml file, you can register an event handler by list template ID. When the containing feature is activated per SPWeb object, you can register the event handler for any list of the specified type.

Declaratively by content type, for example, to register an event handler for all documents of a specific type. Within the XML for a content type definition, you can register event receivers.

wss 2.0 “after the fact
wss 3.0 “before the fact and after the fact also





Debug windows service

install service in vs command prompt
start the service in services.msc

in vs attach to process . show from all users and processes sessions checkboxes

Then attach to the service (search with the same name .. u can click refresh button) in the list of services box in vs

CAML (Collaborative Application Markup Language)
Two elements of CAML
Data Definition Elements
Data definition elements are used to define lists and sites in the same style as basic XML (but with a limited set of keywords).

EG, “Fields” tag defines Field Type=”Counter” Name=”ID” . . . other field definitions. . .

Data Rendering Elements
CAML allows for the generation of HTML based on specific sets of tags.


 C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\

 This file is used to register the available BaseTypes, NavBars, ListTemplates, DocumentTemplates, and Modules that can be used with instances of the site.
The following kinds of tasks can be performed in a custom Onet.xml to create a custom site definition:
* Specify an alternate cascading style sheet (CSS) file, JavaScript file, or ASPX header file for a site definition.
* Modify navigation areas for the home page and list pages.
* Add a list definition as an option to the Create page.
* Add a document template for creating document libraries.
* Define one or more configurations for the site definition, specifying the lists, modules, files, and Web Parts that are included when a site definition configuration is instantiated.

14. Object model

SPSite (virtual server)



Debugging webparts

attach to w3p.exe process

delete pdb files

Old one is DES
then Rijndael in .net 2.0 came
then 3.5 has AES alongwith Rijndael (
AES algorithm : Advanced Encryption

Sharepoint timer control
SP breadcrumb control
17. for windows installer assemblyinstaller class is there
18. how to create an installer for webservice project in vs 2005
FILE –> NEW –> Project :  Then I selected web application and wrote some code. Then  I added setup deployment project.  It is working fine.   2nd Case: FILE->New–>Project .. Then I selected webservice template and wrote some code. Then I added setup template project. THis is not working…

3rd case : File -> New –> website .Then I selected web application and added setup template. It is not working

4th case : File->NEw–>Website .. THen I selected webservice and added setup template. It is also not working.
Ans :

difference between webapplication and webproject in vs 2005:
You receive a “Cannot connect to the configuration database” error message when you connect to your Windows SharePoint Services 2.0 Web site

D:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\ADMIN\CACAdminPages  .. first.aspx and second.aspx

D:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\LicenseManager      feature.xml and extensions.xml

use stsadmn tool to register
D:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN this stsadm is present.
See the syntax and register this feature


how to create strong key

right click on project — go to properties –signing –> check sign the assembly. Give name
then build and copy the dll and paster in assembly folder.
right click the dll of assembly and get the public key token.
copy that public key token.
Open D:\Inetpub\wwwroot\wss\VirtualDirectories\31333 web.config then add safecontrols tag and paste the public key token value.

Microsoft provides ways to extend the out of the box functionality of SharePoint Portal Server 2007 e.g. Features, SharePoint Designer 2007, Windows Workflow Foundation etc. Features offer flexibility in terms of developing extended functionality – such as Page Templates, List, Content Types, Web Parts, Workflow and events – to new and existing SharePoint 2007 sites.

new form of deployment, namely Solution Deployment. Solutions are custom packages (e.g. WSP file) or redistributable CAB files
Issue faced:

The security validation for this page is invalid. Click Back in your Web browser, refresh the page, and try your operation again. at Microsoft.SharePoint.Library.SPRequestInternalClass.ValidateFormDigest(String bstrUrl, String bstrListName)
at Microsoft.SharePoint.Library.SPRequest.ValidateFormDigest(String bstrUrl, String bstrListName)

It is the problem of postback and SP is not trusting us as it may be from cross site scripting.
I have a custom page and put it in template/admin . Then  Iplaced a button . On button click I am doing my logic.

How I resolved: I included Sharepoint master pages.

I installed sharepoint 2007 extensions tools for vs 2008
It comes up with sharepoint templates in vs like webpart template

I got errors while deploying the webpart liek the below ( so I again went to classlibrary .. create snk key ,,, put dll in gac … then safecontrol in web.config of the particular site … use reflector for publickeytoken.. for debugging add to w3wp for getting processid if more applica are running then run iisapp.vbs we will get pid,site name and port no.)

assemblies that implement webparts and are installed into a partially trusted location. must be compiled allowpartiallytrustedcallerattribute set for import to succeed, such as the bin directory ,

Solution: I made it an entry in safe control and placed in bin of site .so error. Once providing safe control entry in web.config we have to place the dll in gac.

2. This solution contains two assemblies with the same name, or the SharePoint server already has an assembly with the specified name.
One more solution apart from feature … delete the dll from c:\windows\assembly folder by rightclick uninstall
3.Attempted to perform an unauthorized operation.

Deploy will put dll in assembly folder

COPy Paste mechanism wont work in the usual way in assembly folder . use Drag & Drop from ur applica folder to assembly folder.

Error 1 The feature name SPJagEvent already exists in SharePoint. You need to rename the feature before solution deployment can succeed.  0 0 
5. If I am adding a developed  webpart dll directly into bin folder of wss/virtualdirectories/port/bin and If i am adding that webpart into site
then it is not adding and warning is coming” that it has no allowpartialtrustedcallers.

If I am adding the developed webpart dll into assembly folder then the above warning is not coming.

to mitigate the above warning
we have to edit assemblyinfo.cs file and add the below code
using System.Security;
6. Sometimes all the dlls in assembly disappears . y?
site actions->site settings -> modify all site settings- > gallery webparts -> new -> populate gallery

Event handling
In v2 (2003) we only had synchronous event handlers, meaning we could only write code to do something “after” something happened in SharePoint. Now, in the new version we also have asynchronous event handlers, meaning we can write code to do something “after” something happens and also “before” something happens.


in vs 2008 select 3.5 framework

File->new -> website …> webservice template .filesystem c# appln


Add webreference and not Add service reference (point to be noted0


    public string HelloWorld()

        webList.Lists myservice = new webList.Lists();

            /*Authenticate the current user by passing their default
            credentials to the Web service from the system credential
            cache. */
            myservice.Credentials =

            /*Set the Url property of the service for the path to a subsite. Not setting this property will return the lists in the root Web site.*/
            myservice.Url =

            /*Declare an XmlNode object and initialize it with the XML
            response from the GetListCollection method. */
            System.Xml.XmlNode node = myservice.GetListCollection();

            /*Loop through XML response and parse out the value of the
            Title attribute for each list. */

            string conc = string.Empty;
            foreach (System.Xml.XmlNode xmlnode in node)
                conc += xmlnode.Attributes[“Title”].Value + “\n”;

            return conc;
In Sp web.config

during development phase set these in web.config to display actual error messages in sp app site

 <trust level=”Full”    ….if not security permission error comes for the deployed dll

 <SafeMode MaxControls=”200″ CallStack=”true”

   <customErrors mode=”Off” />

Forms Authentication

inetmgr rightclick –>edit configuration


event handling (

Event Types


==== gridview  header is aligned to center
if u want to align to left
 HorizontalAlign=”Left” UseAccessibleHeader=”false” in gridview
then apply ItemStyle-HorizontalAlign=”Left” to all template and bound columns


For sending mails

In iis install smtp server and configure it
antivirus console disable it.
For mass mailing “Anti Virus standard protection” uncheck prevent mass mailing worms from sending mail .

running configuration tool ie aspnet_regiis to install db for roles and membership

Below is the batch file
@echo off
SET FrameWorkFolder=C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727
SET VFolder=Asp.NetWebAdminFiles
SET Port=8099
SET App=/Portal
SET AppPath=C:\Inetpub\wwwroot\wss\VirtualDirectories\4445\UserManagement\

explorer “http://prolap0213:%Port%/%VFolder%/default.aspx?applicationPhysicalPath=%AppPath%&applicationUrl=%App%

%FrameWorkFolder%\WebDev.WebServer.EXE /port:%Port% /path:%FrameWorkFolder%\%VFolder% /vpath:/%VFolder%


SP workflows
Put the dll in GAC

Create feature folder by name  SimpleSequentialDocumentReviewLatest:  at this path

D:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\
Create two xml files … one feature.xml and flow.xml

To install the workflow:

D:\Documents and Settings\Administrator>”D:\Program Files\
   Common Files\Microsoft Shared\web server extensions\12\BIN\
   STSADM.EXE” -o installfeature -name SimpleSequentialDocumentReviewLatest -force

To activate the workflow:


D:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN>stsa
dm.exe -o activatefeature -name SimpleSequentialDocumentReviewLatest -url http:/
/prodsk0657:1234/  -force



Business Data Catalog bridges the gap between the portal site and your business applications and enables you to bring in key data from various business applications to Office SharePoint Server 2007 lists, Web Parts, search, user profiles, and custom applications.

Business Data Catalog provides built-in support for displaying data from databases and Web services. That is, you can use Business Data Catalog to display data from your SAP, Siebel, or other line-of-business (LOB) application via Web services or databases.

Business Data Web Parts

Business Data in Lists

Business Data Actions

Business Data Search

Business Data in User Profiles

workflows engines


issue 1:
HTTP/1.1 404 Connection: close Date: Sun, 29 Jul 2007 00:33:23 GMT Server: Microsoft-IIS/6.0 X-Powered-By: ASP.NET MicrosoftSharePointTeamServices:
Central Administration -> Home -> Application Management -> Create/Extend web application

You created site. Then another screen opens in central admin alerting for creating sitecollection but forgot to create that.
And u opened http://localhost:[portnumber]/   in browser
then this problem arises
If you receive the above error message when you try to browse your WSS site with web browser, most probably is because you haven’t create the Top-leval site collection. WSS will not create the top-level site collection for you by default. To create the top-level site collection, goto Central Administration –> Application Management –> Create Site Collection

issue 2:
403 forbidden
service unavailable

For the above errors root cause is:

U have changed the windows system login password . But Sharepoint inetmgr applicaiton pool idenity was not changed.

Go to inetmgr. Go to application pool. Rightclick on ur application pool and select properties. Go to identity tab. Give ur latest windows user name and password after selecting configurable radio button.

Document Library:
Explorer view
can drag a file from desktop to application

MS word 2007: Document Information Panel: Office button icon->Prepare –>Properties
MS word 2003 : View ->Task Pane->Document Information tab

Sharepoint 2007: List Events Practical Example: Creating a rigged survey!!



One Response to Sharepoint running notes

  1. singapore public speaking courses…

    […]Sharepoint running notes « code siblings,adventures,songs and excerpts of my daily work[…]…

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: