Saturday, September 22, 2012

SharePoint 2010 Upgrade approach

I gathered notes from various resources and MSDN to understand better,learn and apply my knowledge on this topic.Here I placed very short description. My intention is this blog entry will help someone to spark the idea for their task.

There are two types of Upgrade approach from SharePoint 2007 to SharePoint 2010.



  • In-Place upgrade and
  • Content Database attach method

  • Consider this scenario,



  • Your SharePoint 2007 server or farm is a 32 bit based environment.
  • Your operation system Windows server 2000 or 2003 and SQLServer 2000 based 32 bit. based.


  • In these situation you cannot use the In-Place upgrade approach.

    So you need to upgrade your server or farm to support the 64 bit application then migrate your 32 bit SP 2007 to 64 bit application.

    Then you can start the actual In-Place upgrade. It requires lot of efforts and time consuming and costly process in term of upgrading the hardware and software.

    Simple approach for the above scenario is "Content Database attach" method. Before this your SQL Server meet the following requirement. It must be updated to SQL Server 2005 SP3 and the n Upgrade to SharePoint 2010 and move your content database to this new set up and connect this server to your SharePoint 2010 Farm.

    Tuesday, September 04, 2012

    Adding SPUser programmatically

    This few lines of code will be helpful for adding the SharePoint User or SharePoint Group through code. The string value for user id was given in excel format.My workaround was parsing the string in to token and identifying the user's windows log in id. Then inserting this value into people picker and updating the respective item. I have only one user to be added.If you have collection of users then you need to split the strings in comma delimiter and use the SPFieldUserValueCollection class.
     using (SPSite site = new SPSite(SPContext.Current.Site.Url))
                {
                    using (SPWeb web = site.OpenWeb())
                    {
                        SPUser userObj = SPContext.Current.Web.EnsureUser("Murugesan");
                        SPFieldUserValue userValue = new SPFieldUserValue(SPContext.Current.Web, userObj.LoginName);
                        SPList list = web.Lists["Project"];
                        SPListItem item = list.Items.Add();
                        item["Title"] = "Project-2";
                        item["Manager"] = userValue;
                        item.Update();
                    }
                }
    

    Sunday, September 02, 2012

    Split with multiple delimiter character

    Recently I have received an excel file in which one column formatted the AD users in "ID:FirstName,LastName". I need to split the string ID only from the above string.I spent couple of hours to do it generic collection / LinQ based.But finally I end up with the classic way of splitting the string. Here is my workaround.
    List list = new List();
    List list2 = new List();
    string input="MBUPN1:Murugesan,Pandian,MBUPN2:Murugesan,Pandian,MBUPN3:Murugesan,Pandian";
    string[] parts1 = input.Split(',');
    for (int str = 0; str < parts1.Length; str++)
    {
    if (parts1[str].Contains(":"))
    {
    list.Add(parts1[str]);
    }
    }
    foreach (string zz in list)
    {
    string[] len = zz.Split(':');
    list2.Add(len[0].ToString());
    }
    foreach (string K in list2)
    {
     Response.Write(K);
    }