Tuesday, October 26, 2010

Clearing the Cache in SharePoint

In case you encounter the Update Conflict Error:

1. Stopping wss timer job, Saving Copy of the cache.ini file from C:\Documents and Settings\All Users\application data\Microsoft\SharePoint\Config folder. Clearing all the .xml files from the location except cache.ini but Edit the cache.ini to have value 1. Starting the timer job

2. Rerun the Sharepoint technology wizard on the server.

3. If all above doesnt work, you may run the configuration wizard. select the option to disconnect the server from server farm and revert back again at next step (so you actually do not disconnect). Selected the option as not to disconnect from server farm and ran the wizard successfully.


Monday, October 25, 2010

MOSS 2007 Backup & Restoration

Back up a farm by using SQL Server tools (Office SharePoint Server 2007)


Restore a farm by using SQL Server tools (Office SharePoint Server 2007)

Tuesday, July 20, 2010

SharePoint Patterns & Practices

The download includes patterns & practices for both SharePoint 2007 and 2010, applicable for implementing content-driven or event-driven SharePoint applications as well as integrating line of business applications.

Must read.

Thursday, June 10, 2010

Notes on Workflows

  • TaskName_MethodInvoking
  • Listen Activity
    • OnWorkflowItemChanged
    • OnWorkflowItemDeleted
  • WorkflowProperties.Item("Name").String

Wednesday, June 9, 2010

SharePoint Version

From the Site Settings Page
  • Go to Site Actions > Site Settings
 From the Central Administration Page
  • Go to SharePoint 3.0 Central Administration
  • Operations > Servers in Farm

Thursday, June 3, 2010

Publishing an InfoPath Form w/ Custom Code
1. Tools > Form Options > Set Upgrading to Do Nothing
2. File > Publish > To a SharePoint Server with or without InfoPath Forms Services
3. Choose to publish an Administrator-approved form template

Tuesday, May 18, 2010


InfoPath forms with custom-code will require an add-in called VSTA (Visual Studio Tools for Application). VSTA can be added through the MS Office Enterprise instance (Control Panel > Add/Remove Programs > Change).

Thursday, March 25, 2010

Creating, Modifying SharePoint Views Programmatically

Creating a New View
String[] colArray = new String[] { "Column1", "Column2", "Column3” };
StringCollection colCollection = new StringCollection();
String viewQry = “Your CAML Query Here’;
SPView newView = YourList.Views.Add(“View Title”, colCollection, viewQry, 100, true, false);

Note: 100 is the item limit, true is allow paging and false is to set as the default view

Adding Fields to an Existing View
SPList oList = oWebsite.Lists["List_Name"];

SPView oView = oList.Views["All Items"];
SPViewFieldCollection collViewFields = oView.ViewFields;

Adding a "Group By" to the View
String query =  "";
view.Query += query;

Tuesday, March 23, 2010

String Manipulations in ASP.NET

Find String within string
This code shows how to search within a string for a sub string and either returns an index position of the start or a -1 which indicates the string has not been found.

string MainString = "String Manipulation";
string SearchString = "pul";
int FirstChr = MainString.IndexOf(SearchString);

Strip specified number of characters from string
This example show how you can strip a number of characters from a specified starting point within the string. The first number is the starting point in the string and the second is the amount of chrs to strip.

string MainString = "S1111tring Manipulation";
string NewString = MainString.Remove(1,4);

Thursday, March 18, 2010

Creating Lookup, Multi-Value Fields in SharePoint

Because lookup fields are not included when you save a list as template in SharePoint, you might need to create custom code to programmatically add these fields to a list during site provisioning. Here's how:

SPSite site = new SPSite (siteURL);
SPWeb web = site.OpenWeb();
SPList departmentList = web.Lists["Department"];
SPList employeeList = web.Lists["Employees"];
employeeList.Fields.AddLookup("Department", departmentList.ID, false);

Lookup field in this case is the Department field which was added to the Employee list. Afterwards, you may set this field as a multi-value field:

SPFieldLookup categoryField = (SPFieldLookup)eLibrary.Fields[fldName];
categoryField.AllowMultipleValues = true;

Reading XML Documents

XmlDocument doc = new XmlDocument();
XmlNode root = doc.DocumentElement;
string url = root.SelectSingleNode("url").ChildNodes[0].Value;

Thursday, March 4, 2010

Custom Field Types in SharePoint

Minimum requriements:

A field type definition. This field type definition is an XML file that contains the information that Windows SharePoint Services needs to correctly render the field, including its column header, on list view pages (such as AllItems.aspx). It is typically also used to render the field on the view list item page (DispForm.aspx) and sometimes it is used to render the field on the New or Edit (list item) pages. It can also declare and define special variable properties of the field type whose values will be set whenever a column is created based on the field type. Most importantly, it contains information about the assembly that includes the compiled field type.

A field class. This is a class whose instances can represent particular fields that are based on your custom field type. This class must inherit from SPField or one of the classes in Windows SharePoint Services that derive from it. The class is compiled into a strong-named assembly and you deploy it to the global assembly cache. In the context of a list view, an SPField object represents a column and its properties, such as whether it can be sorted. In the context of the Display, New, and Edit modes, an SPField object represents a particular field of a list item — a cell in the table that constitutes the list — and the value of that cell in the content database.

A rendering control class. This is a class that can be used, in conjunction with a rendering template (see below), to render your fields in New mode or Edit mode, or, less commonly, in Display mode. This class must inherit from BaseFieldControl or one of the classes in Windows SharePoint Services that derive from it. This class is compiled into the same assembly as the field class.

A rendering template. The rendering template is defined in an .ascx file located in C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\ControlTemplates.

An editing control for the variable properties of the field type. All field types require a name, a data type, a description, and other common properties; but many field types also have properties that are relevant only to fields of that particular type. These variable properties are set by users in the UI when they create a new column that is based on the field type. Usually, an element in the field type definition (see above) determines how these property setting controls are rendered. But sometimes a special editing control is required. Such a control is defined in an .ascx file that usually has a code-behind file that contains its logic. Creating a special editing control is recommended if you need to perform custom functions, such as complicated computational logic, looking up values from data sources, or custom data validation of the values that a user might choose when configuring a new column.

Source: http://msdn.microsoft.com/en-us/library/ms446361.aspx

Wednesday, March 3, 2010

Event Handler Explorer

Determine whether an event-handler has been successfully attached to your lists or document libraries:

Signing an Assembly in .NET

Here are steps in order to sign an assembly using Visual Studio and be able to deploy that to the GAC:
  1. Open the Project within Solution Explorer
  2. Right-Click and Select Properties
  3. Switch to the "Signing" tab
  4. Select the option to "Sign the Assembly"

Lutz Roeder's .NET Reflector

The.NET Reflector is a class browser and decompiler that can examine an assembly and show you just about all of its secrets. The .NET Framework introduced reflection which can be used to examine any .NET-based code, whether it is a single class or an entire assembly. Reflection can also be used to retrieve information about the various classes, methods, and properties included in a particular assembly. Using .NET Reflector, you can browse the classes and methods of an assembly, you can examine the Microsoft intermediate language (MSIL) generated by these classes and methods, and you can decompile the classes and methods and see the equivalent in C# or Visual Basic® .NET.

You may download here.

Sunday, January 31, 2010

Chapter 2: MOSS Search




schema.AllManagedProperties.Create(name, type);


mappings.Add(new Mapping(crawledprop.Propset, crawledprop.Name, crawledprop.VariantType, managedprop.PID));


Customizing the Search Center
  • Lite - does not require Publishing Feature
  • IIS Web Application is associated to an SSP
  • With Tabs - fully customizable
    • Page layouts - Search Page (Search Box WP), Search Results Page, Advanced Search Page (Advanced Search Box WP), People Search Results Page 
    • Tabs - All Sites, People; are items stored in two lists
  • Search Box WP - has a Scopes Dropdown
  • Search Summary WP - corrects the Spelling
  • Search Core Results WP - stemming is disabled by default. Example: buy matches buying, bought. Noise word query is enabled by default. Example: the, a, an. Can be configured to have a fixed keyword query. Has a Selected Columns property that you can add/remove from.

Monday, January 25, 2010

Sample Stored Procedure, Query for SSRS

@startDate DATETIME, @endDate DATETIME
c.CustomerID, c.CompanyName,
c.City, c.ContactName,
o.OrderID, o.OrderDate,
od.UnitPrice, od.Quantity,
od.UnitPrice * od.Quantity AS ExtendedPrice
Customers c
Orders o ON c.CustomerID = o.CustomerID
[Order Details] od ON o.OrderID = od.OrderID
o.OrderDate BETWEEN @startDate AND @endDate
c.CompanyName, o.OrderDate


S.OrderDate, DATENAME(weekday, S.OrderDate) as Weekday,

S.SalesOrderNumber, S.TotalDue, C.FirstName, C.LastName
HumanResources.Employee E
Person.Contact C ON E.ContactID = C.ContactID
Sales.SalesOrderHeader S ON E.EmployeeID = S.SalesPersonID
(S.OrderDate BETWEEN (@StartDate) AND (@EndDate) AND
S.SalesPersonID IN (@SalesPersonID))

Thursday, January 14, 2010

Finding the Id (Guid) for a SharePoint List

From Nick Grattan:
There are times when you need to find the Id (a Guid) of a list – for example, when setting the Task list to be used with SharePoint Designer Workflows (see my blog post here). Here’s a simple way of doing this:

•Navigate to the SharePoint list using the browser.
•Select the Settings + List Settings menu command.
•Copy the Url from the browser address bar into Notepad. It will look something like:


•Delete everying before and including “List=”.
•Change “%7B” to “{”
•Change all “%2D” to “-“
•Chnage “%7D” to “}”

You are now left with the Id: {26534EF9-AB3A-46E0-AE56-EFF168BE562F}

From Ken Pespisa:
A (slightly) easier way if you have MOSS 2007 is to go to the List or Library settings as described above, then right-click on the “Audience targeting settings” or “Information management policy settings” links and choose Copy Shortcut.

You can then paste the URL and there’s no need to decode the GUID. For some reason these links aren’t URL encoded.

Source: http://nickgrattan.wordpress.com/2008/04/29/finding-the-id-guid-for-a-sharepoint-list/

Tuesday, January 12, 2010

How to Activate the Report Server Feature

  1. Click Start, click Administrative Tools, and then click SharePoint 3.0 Central Administration.
  2. Click Site Actions.
  3. Click Site Settings.
  4. Click Site Collection Features.
  5. Find Report Server Integration Feature in the list.
  6. Click Activate.

MOSS+SSRS Related Topics

  • To debug during the setup of "Reporting Services Add-In for Sharepoint: There is a setup log file in the %temp% folder for the user (under Local Settings folder) who is installing the Reporting Services Add-in. The file name is RS_SP_.log
  • If the "Reporting Services" feature do not show up within Central Administration, it is because the feature failed to activate within the Site Collection during setup. You must run the "Add-In" with the same user account you used to install MOSS 2007.
  • If the Report Server feature is not fully installed within a site collection, execute the following command: stsadm -o activatefeature -name ReportServer -url http://siteCollectionURL
  • After applying SP2, under "Database Setup" when you try to create a new database: you may encounter an error that says the DB cannot be found. When you check within the SQL Server, you will observe that the Database has been created. This means, there's nothing wrong with permissions... the "update" scripts failed due to a BUG. What I did is to name the Report Server DBs without appending the "ReportServer" name. After doing so, the DB Setup completed without problems.
    • Old Name: MOSSDEVReportserver
    • New Name: MOSSDEV
  • What to customize per report: Query Parameters or Filters, Number Format, Sorting, Header/Footer, Totals
Filters vs. Parameters
Reporting Services has several methods for dynamically filtering report contents, including the following:
Query parameters filter data at the source as it is retrieved.

Report filters, applied to a dataset or data region, limit the data that is displayed from a generated report.

Using filters retrieves all data, but only data that is relevant to the user is displayed. This may be less efficient on an individual report basis than filtering at the source. However, it lets you retrieve the data once from the source and store in it a snapshot to serve many different user communities. On the other hand, when using query parameters, you must revisit the data source for each new value of the query parameters. Filters enable you to use execution snapshots and still get full parameterization.

Source: http://technet.microsoft.com/en-us/library/cc966445.aspx

SSRS 2005 Installation
SSRS 2005 Creation of Reports Tutorial
SSRS 2005 Troubleshooting