SharePoint 2010 Performance Dashboard – Farm Content Size Reporting(Post 2/2)

  Here I have mentioned the code which can be useful to get the Content DB, Site Collection Usage details.   SPFarm farm = SPFarm.Local; SPWebService service = farm.Services.GetValue<SPWebService>("");   string webappName = ""; SPWeb web = null; SPUserCollection owners = null; string OwnerString = ""; int count = 0;   foreach (SPWebApplication webapp in…

0

SharePoint 2010 Performance Dashboard – Farm Content Size Reporting(Post 1/2)

  In this post we will look into how I did “Farm Content Size Reporting” part of the project, We have two types of reporting in this functionality. Content Databases per Web Applications Report Site Collections per Content Databases Report This can be useful for a very large size farm and where there could be…

0

How to remove “Open with (Windows) Explorer” button from Document Library’s Ribbon Menu

Recently I had come across a situation in which customer wanted to remove the “Open with (Windows) Explorer” button from the Document Library’s Ribbon Menu. Following are the steps to remove this button from Ribbon Create an empty SharePoint 2010 Solution, you may give your favorite name to it Add a feature by right clicking…

1

Developing Applications for SharePoint 2010 – The release of patterns & practices

Overview Developing Applications for SharePoint 2010 contains guidance documentation, detailed examples, and a reusable class library. These resources are designed to help solution developers and architects make the right decisions and follow proven practices when designing and developing applications for SharePoint 2010. The guidance focuses primarily on the building blocks that every developer needs to…

0

Automatically restart the failed workflow instances

Recently I came across a situation in which customer had email enabled a document library and he had setup a custom workflow to start whenever any new item is added in the library. This setup was working as expected but when end-users send some higher number of emails at the same time (lets say 20-30…

1

Webpart code to dynamically load a page viewer webpart to display a requested page

1: using System; 2: using System.Runtime.InteropServices; 3: using System.Web.UI; 4: using System.Web.UI.WebControls; 5: using System.Web.UI.WebControls.WebParts; 6: using System.Xml.Serialization; 7:   8: using Microsoft.SharePoint; 9: using Microsoft.SharePoint.WebControls; 10: using Microsoft.SharePoint.WebPartPages; 11: using System.Xml; 12: using System.ComponentModel; 13:   14: namespace WebPart1 15: { 16: [Guid("8517b24e-202c-4319-8960-303996a3fdb6")] 17: public class WebPart1 : System.Web.UI.WebControls.WebParts.WebPart 18: { 19: public WebPart1()…

2

Code snippet to copy documents from one document library to another

1: using (SPSite site = new SPSite("http://ms10:200/sites/200")) 2: { 3: using (SPWeb web = site.OpenWeb()) 4: { 5: SPList lib1 = (SPDocumentLibrary)web.Lists["Documents"]; 6: SPList lib2 = (SPDocumentLibrary)web.Lists["Site Collection Documents"]; 7: byte[] fileBytes = null; 8: string destUrl = null; 9: SPFile destFile = null; 10: foreach (SPListItem item1 in lib1.Items) 11: { 12: fileBytes =…

1

Code snippet to create a Tasks list and associate it with a Parallel Approval workflow in a Pages library

The requirement to write this code was, After export/import, workflow modification for approvers was failing. Approvers were not able to perform the Approval workflow operations and then we tested that if we create a new Tasks list and modify the existing Approval workflow association then everything starts working so we needed a code which can…

0

Code snippet to download the files along with versions from SPS 2003 document library.

1: private void Download() 2: { 3: string siteUrl = txtSite.Text.ToString(); 4: string source = txtDocLib.Text.ToString(); 5: string downloadPath= txtDownload.Text.ToString(); 6: byte[] vContent = null; 7: int count = 1; 8:   9: using (SPSite site = new SPSite(siteUrl)) 10: { 11: using (SPWeb web = site.OpenWeb()) 12: { 13: SPFolder sourceFolder = web.GetFolder(source); 14:…

0

Code snippet to add / modify columns in a list

It iterates through a whole site collection and wherever the list with name “test” it finds, It will do the changes. 1: using System; 2: using System.Collections.Generic; 3: using System.Text; 4: using Microsoft.SharePoint; 5:   6: namespace ConsoleApplication1 7: { 8: class Program 9: { 10: static void Main(string[] args) 11: { 12: using (SPSite…

0