SharePoint Twitter WebParts

Are you looking to show the twitter updates of your organization on your sharepoint portal ? If yes, then we are providing two webparts for SharePoint 2007 & SharePoint 2010, one that can be used to show the tweets of any user on the SharePoint portal. Second webpart can be used to post tweet to twitter directly from your sharepoint portal. Just download and install, and you are all set.

All you need is to configure the twitter settings after installation.

These web parts use out of the box SharePoint CSS elements that match automatically with your current site theme.

Update Choice field through Web Service

Updating the choices in a choice column is easy through SharePoint web services.

//Get the service ready
listsWS.Lists wsList = new listsWS.Lists();
wsList.Credentials = new System.Net.NetworkCredential("username", "password","domain");
wsList.Url = strWebSiteURL;

//Prepare the node for updating SharePoint Choice Column/field

XmlDocument xmlDocField = new System.Xml.XmlDocument();
System.Xml.XmlElement xFields = xmlDocField.CreateElement("Fields");
xFields.SetAttribute("OnError", "Continue");

StringBuilder strChoice = new StringBuilder();
//Define the attributes for fields and in case of any errors, try defining all fields

//Notice the capital name of nodes
strChoice.Append("Option 1");
strChoice.Append("Option 2");
strChoice.Append("Option 3");

xFields.InnerXml = strChoice.ToString();

//Call the UpdateList Method
XmlNode xResultUpdateField = wsList.UpdateList("List Name", null, null, xFields, null, null);

SharePoint Facebook WebParts

Have you ever needed to show the facebook updates of your organization on your sharepoint portal ? If yes, this project is for you.

What we provide is two webparts for SharePoint , one that can be used to show the facebook wall of any user on the SharePoint portal. Second webpart can be used to post updates to facebook directly from your sharepoint portal. Just download and install, and you are all set

Sharepoint Multiple Lookup Field : SPFieldLookupValueCollection

Field Class: SPFieldLookup
Field Value Class: SPFieldLookupValueCollection

How to use the lookup column values (through a method)?
itemValues.ForEach(Operate)      //Operate is the method name
void Operate(SPFieldLookupValue iValue) //All LookUp values are passed to function one by one

How to use the lookup column values?
SPFieldLookupValueCollection itemValues = (SPFieldLookupValueCollection) item["FieldName"];
            foreach (SPFieldLookupValue iValue in itemValues)
                int nID =  iValue .LookupId;
                string strValue =  iValue .LookupValue;

SharePoint 2010 Site templates : how to deliver with custom assemblies

The site templates are no longer .stp file in 2010, but they are improved upon as solution files (.wsp). That changes the delivery equation a lot, as earlier we could deliver site templates as a part of solution. But never-than less, in Visual studio 2010 we have the option to import the solution and operate it upon.

Follow these steps to deliver a site template customized with a custom assemblies (web part, event handler etc)
  1. Save the site as template to generate the .wsp file
  2. Import the solution in Visual Studio 2010 to create a new project

  3. Next, right click on the package to open Solution Designer

  4. In the advanced tab, you can specify new assemblies (ensure that they are included in the project)

  5. The default features can also be modified in the edit options of the features. The properties specified here will overwrite the existing feature properties

  6. All set, simply create the package of the project and deliver the wsp file.

Custom DLLs in Bin folder

Untrusted solutions
Deploying custom code in bin folders can cause slow server performance. Every time a page containing untrusted code is requested, SharePoint Server 2010 must perform security checks before the page can be loaded.Unless there is a specific reason to deploy untrusted code, you should install custom assemblies in the GAC to avoid unnecessary security checking.

10 Steps to optimize Sharepoint Performance

An article by Eric Shupps, Network World shed light on the 10 steps to improve the performance of our SharePoint servers.

  1. Separate user and database traffic
    A common misconception is that servers connected to a high-speed network segment will have plenty of bandwidth to perform all required operations. But SharePoint places a tremendous amount of demand on SQL - each request for a page can result in numerous calls to the database, not to mention service jobs, search indexing and other operations. In order to mitigate the conflict between user and database traffic, connectivity between front-end servers and SQL should be isolated, either via separate physical networks or virtual LANs. Typically this requires at least two separate network interface cards in each front-end Web server with static routes configured to ensure traffic is routed to the correct interface. The same configuration may also be applied to application and index server.
  2. Isolate search indexing
    A typical medium server farm consists of one or more Web front-end servers, a dedicated index or application server and a separate SQL database server. Search traffic initiated by the index server must be processed by the same servers responsible for delivering user content. In order to prevent search and user traffic from conflicting, an additional server may be added to the farm, which is dedicated solely to servicing search queries (in smaller environments, the index server may also serve this function). The farm administrator would then configure the search service to perform crawls only against this dedicated server. This configuration may reduce traffic to the Web front-end servers by as much as 70% during index operations.
  3. Adjust SQL parameters
    One quick way to avoid future headaches is to provision the major SharePoint databases on separate physical disks (or LUNs if a storage-area network is involved). This means one set of disks for search databases, one for temporary databases and still another for content databases. Additional consideration should be given to isolating the log files (*.ldf). Although these do not incur the same level of I/O as other files, they do play a primary role in backup and recovery and they can grow to several times the size of the master database files.Another technique is to proactively manage the size and growth of individual databases. By default, SQL grows database files in small increments, either 1MB at a time or as a fixed percentage of database size (usually 10%). These settings can cause SQL to waste cycles constantly expanding databases, and prevents further data from being written while the databases are expanding. An alternative approach is to pre-size the databases up to the maximum recommended size (100G) if space is available and set auto growth to a fixed size (e.g. 10MB or 20MB).
  4. De-fragment database indexes
    SQL Server maintains its own set of indexes for data stored in various databases in order to improve query efficiency and read operations. Just as with files stored on disk, these indexes can become fragmented. It is important to plan for regular maintenance operations, which includes index defragmentation. Special care should be taken to schedule these types of operations as they are resource-intensive and, in many cases, can prevent data from being written to or read from the indexes.
  5. Distribute user data across multiple content databases
    Most SharePoint data is stored in lists: tasks, announcements, document libraries, issues, picture libraries, and so forth. A great deal of this data is actually stored in a single table in the content database associated with the site collection. Regardless of how many sites and subsites are created within the SharePoint hierarchy, each site collection has only one associated content database. This means that a site collection with thousands of subsites is storing the bulk of the user data from every list in every site in a single table in SQL. This can lead to delays as SQL must recursively execute queries over one potentially very large dataset. One way to reduce the workload is to manage the mapping of site collections to content databases. Administrators can use the central administration interface to pre-stage content databases to ensure that site collections are associated with a single database or grouped logically based on size or priority. By adjusting the 'maximum number of sites' setting or changing database status to "offline", administrators can also control which content database is used when new site collections are created.
  6. Minimize page size
    For SharePoint users connected to the portal via a LAN it is easy to manage content and find resources, but for users on the far end of a slower WAN link the heavyweight nature of a typical SharePoint page can be a real performance-killer. If you have many remote users, start with a minimal master page, which, as the name implies, removes unnecessary elements and allows designers to start with a clean slate that only contains the base functionality required for the page to render correctly. Second, most SharePoint pages contain links to supporting files, including JavaScript and style sheets, which require additional time to retrieve and execute. Designers can alter how SharePoint pages retrieve these files using a technique called "delayed loading", which essentially loads the linked files in the background while the rest of the page is rendering.
  7. Configure IIS compression
    SharePoint content consists of two primary sources -- static files resident in the SharePoint root directories (C:\Program Files\Common Files\Microsoft Shared\12 for 2007 and \14 for 2010) and dynamic data stored in the content. At runtime, SharePoint merges the page contents from both sources then transmits them inside an HTTP response to the requesting user. Internet Information Server (IIS) versions 6 and 7 both contain various mechanisms for reducing the payload of HTTP responses prior to transmitting them across the network. Adjusting these settings can reduce the size of the data transmitted to the client, resulting in shorter load times and faster page rendering.
  8. Take advantage of caching
    Much of the content requested by users can be cached in memory, including list items, documents, query results and Web parts. Site administrators can configure their own cache profiles to meet different user needs. Anonymous users, for example, can be assigned one set of cache policies while authenticated users are assigned another, allowing content editors to get a more recent view of content changes than general readers. Cache profiles can also be configured by page type, so publishing pages and layout pages behave differently, and administrators have the option to specify caching on the server, the client, or both. In addition, the SharePoint Object Cache can significantly improve the execution time for resource-intensive components, such as the Content Query Web Part. For example, large objects that are requested frequently, such as images and files, can also be cached on disk for each Web application to improve page delivery times.
  9. Manage page customizations
    SharePoint Designer is a useful tool for administrators and power users but page customization can be harmful to overall performance. When customization occurs, the entire page content, including the markup and inline code, is stored in the database and must be retrieved each time the page is requested. This introduces relatively little additional overhead on a page-by-page basis, but in larger environments with hundreds or even thousands of pages, all that back-and-forth to the database can add up to significant performance degradation. To prevent this problem, administrators should implement a policy that restricts page customizations to only those situations where it is absolutely necessary. Site collection and farm administrators also have the option to disable the use of Designer or, when necessary, use the 'reset to site definition' option to undo changes and revert back to the original content.
  10. Limit navigation depth
    One of the most significant design elements on any portal site is the global, drop-down, fly-out menu at the top of each page. It seems like a handy way to navigate through all the various sites and pages -- until it becomes so deep and cluttered that all ability to navigate beyond the first few levels is lost completely. Even worse, fetching all the data to populate the navigation menus can be resource-intensive on sites with deep hierarchies. SharePoint designers have the ability to customize the depth and level of each navigation menu by modifying the parameters for the various navigation controls within the master page. Administrators should limit that depth to a manageable level that does not impact performance.

SharePoint 2010 Themes : DIY

Activating the publishing feature on the SharePoint 2010 site gives you an option to customize the pre-installed theme and save it as "Custom Theme". There can only be one custom theme per site and if somebody else tries to play designer and customize any other theme, then it overwrites your changes. So at a time there is only one custom theme allowed.

An article by Todd Bagsinki details the method of creating .thmx files and using them as SharePoint designer. Though the idea is simple but the output isn't always sweet. Mapping all the classes and images etc. isn't easy at all.

Raymund Macaalay visual guide on SharePoint 2010 has take a clever approach and here is what you have to do to get it done.

  1. Goto theme gallery <site>/_catalogs/theme/Forms/AllItems.aspx
  2. Download a pre-installed theme as sample.thmx file
  3. Get the theme builder free from Microsoft's connect portal and edit the theme so easily
  4. All done, simply save the .thmx file and upload back to site's theme gallery to use it.

SharePoint 2010 Technology Stack

SharePoint 2010 is launching today!!!
Here is 3 minute video for the developers explaining the basics.

Another very good video showing SharePoint 2010 bird eyes view

CAML query for searching users with their ID and not name

When building a CAML query using U2U CAML Query builder, if you need to search for a user then the only option is to provide user's login name. That's not neat and you can beat it by providing an extra parameter called "LookupId" with the field. For example

MyQuery.Query = "<Where><Eq><FieldRef Name='Employee' LookupId='TRUE' /><Value Type='User'>UserID</Value></Eq></Where>";

After specifying the attribute, you can select a user by his/her ID.

Microsoft SharePoint: Three Social Networking Alternatives

Another good article by Shane O'Neill,

"Microsoft's SharePoint suite started out in the early 2000's as a place to store and manage Office documents, but it has quickly evolved into a vast enterprise information portal and content management system. And more and more it's becoming a "social networking platform." read more...

The Great Debate: SharePoint Designer vs. Custom Site Definitions

A good post by Eric Shupps :

"I often get asked about the pros and cons of using SharePoint Designer versus custom site definitions for branding purposes. There seems to be a great deal of confusion surrounding this topic so I'll offer my two cent's worth in hopes that it clears the air and helps you, the SharePoint developer or administrator, make a more informed decision on which to use and where." read more...