Thursday 21 February 2013

Sharepoint 2010 Migration.

Sharepoint 2010 Upgrade requirements:

Before you can perform an in-place upgrade or database attach upgrade to SharePoint Server 2010, your existing Office SharePoint Server 2007 environment or new SharePoint Server 2010 environment must meet the following minimum requirements.

NOTE: For Sharepoint HOT Jobs jobmust 

1.Hardware requirements:

SharePoint Server 2010 can only run on a 64-bit edition of the
Windows Server 2008 R2 or Windows Server 2008 with SP2 O/S.

If you plan an in-place upgrade, your Office SharePoint Server 2007 installation must be running in a 64-bit Windows Server 2008 environment.

If your Office SharePoint Server 2007 installation is currently in a 32-bit environment, you cannot perform an in-place upgrade on the existing server or server farm.

You must install SharePoint Server 2010 on a different server or farm that supports 64-bit applications, and then move your data to that server or farm by using database attach upgrade.

2.Operating system requirement:
Windows Server 2008 or Windows Server 2008 R2:
SharePoint Server 2010 must be run on a 64-bit edition of Windows Server 2008 R2 or Windows Server 2008 with Service Pack 2 (SP2). If you are currently running Office SharePoint Server 2007 on Windows Server 2003 and intend to upgrade to SharePoint Server 2010, you must plan to have a sufficient number of Windows Server licenses for the deployment on the newer operating system.

To more easily discover and address any issues in the migration and upgrade processes, we recommend that you do not combine the actions of upgrading or migrating to Windows Server 2008 or Windows Server 2008 R2 with the process of upgrading to SharePoint Server 2010. You can combine migration to 64-bit hardware with migration to Windows Server 2008 or Windows Server 2008 R2.

3.Pre-upgrade checker

The pre-upgrade checker is a command-line tool that you run in a Office SharePoint Server 2007 environment to find any potential issues for upgrade and to review recommendations and best practices.

STSADM.exe –o preupgradecheck

By using the pre-upgrade checker, you can find information such as the following:

A list of all servers and components in the farm, and whether the servers meet the following requirements for upgrading: 64-bit hardware and the Windows Server 2008 operating system.

The alternate access mapping URLs that are being used in the farm.

1)A list of all site definitions, site templates, features, and language packs that are installed in the farm.

2)Whether there are customizations in the farm that are not supported (such as database schema modifications).

3)Whether there are any database or site orphans in the farm.

4)Whether there are missing or invalid configuration settings in the farm (such as a missing Web.config file, invalid host names, or invalid service accounts).

5)Whether the databases meet the requirements for upgrade — for example, databases are set to read/write, and any databases and site collections that are stored in Windows Internal Database are not larger than 4 GB.

4.Windows PowerShell command to check databases before attaching

You can use the Windows PowerShell cmdlet test-spcontentdatabase before you attach a content database to SharePoint Server 2010 to determine whether any server-side customizations are missing from the environment.

Test-SPContentDatabase [-Identity] [-AssignmentCollection ] [-DatabaseCredentials ] [-ServerInstance ] [-ShowRowCounts ]

Test-SPContentDatabase -Name -WebApplication [-AssignmentCollection ] [-DatabaseCredentials ] [-ServerInstance ] [-ShowRowCounts ]

EX:Test-SPContentDatabase -name WSS_Content_DB -webapplication http://sitename

Set the previous version databases to be read-only (database attach with read-only databases)

If you are using the read-only databases hybrid approach to upgrade, set the previous version databases to read-only before you back up the databases. In any type of database attach upgrade, you can also set the databases to read-only temporarily to ensure that you capture all the data in the backup so that you are restoring and upgrading the current state of the environment. If the databases are set to read-only, users can continue to view content, but they will be unable to add or change content.

To set a database to read-only in SQL Server 2000
In SQL Server Enterprise Manager, right-click the name of the database that you want to set to read-only, and then click Properties.

1.In the Properties dialog box, click the Options tab.

2.Under Access, select the Read-only check box, and then click OK.

To set a database to read-only in SQL Server 2005
1.In SQL Server Management Studio, right-click the name of the database that you want to set to read-only, and then click Properties.

2.In the Select a page section, click Options.

3.In the right pane, under Other options, in the State section, next to Database Read-Only, click the arrow, and then select True.

To set a database to read-only in SQL Server 2008
1.In SQL Server Management Studio, in Object Explorer, connect to an instance of the Database Engine, expand the server, and then expand Databases.

2.Select the database that you want to configure to be read-only, right-click the database, and then click Properties.

3.In the Database Properties dialog box, in the Select a page section, click Options.

4.In the right pane, under Other options, in the State section, next to Database Read-Only, click the arrow, and then select True.

Visual Upgrade

A new feature that is available with upgrade allows the server administrator or site owner to determine when and if the new look for SharePoint Server 2010 is used for a particular site collection. Server administrators can choose to adopt the new look and feel for all sites during upgrade, let site owners make the choice after upgrade, or keep the old look and feel for all sites.

If the server administrator lets the site owners decide, after a site is upgraded by using an in-place upgrade, a preview option is available in the site user interface. This option provides a preview of the SharePoint Server 2010 look for the site:

If the owner likes how the site looks and functions, the owner can accept the visual upgrade.

If the owner wants the site to keep the old look and feel, the owner can revert to the Office SharePoint Server 2007 look.

By default, the Office SharePoint Server 2007 look is retained. For more information, see Plan visual upgrade (SharePoint Server 2010).



collected from http://rahulbach.blogspot.in/2010/06/sharepoint-2010-migration.html

Monday 18 February 2013

Best examples to work with web services

http://developer.yahoo.com/dotnet/howto-xml_cs.html





Using Returned XML with C#

Once you have retrieved data from a web service you will need to do something with it. This HOWTO describes the various built-in methods .NET provides to use XML returned by a web service.

Overview

The .NET Framework provides excellent support for XML. Combined with the databinding support of WinForms and ASP.NET applications you have an easy and powerful set of tools. ASP.NET 2.0 takes databinding another step further by providing the DataSource control which lets you declaratively provide data access to data-bound UI controls.

Returned Data to a String

The simplest way to view the returned data is to get the response stream and put it into a string. This is especially handy for debugging. The following code gets a web page and returns the contents as a string.

C# STRING SAMPLE

  1. public class StringGet  
  2. {  
  3.     public static string GetPageAsString(Uri address)  
  4.     {  
  5.         string result = "";  
  6.   
  7.         // Create the web request  
  8.         HttpWebRequest request = WebRequest.Create(address) as HttpWebRequest;  
  9.   
  10.         // Get response  
  11.         using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)  
  12.         {  
  13.             // Get the response stream  
  14.             StreamReader reader = new StreamReader(response.GetResponseStream());  
  15.   
  16.             // Read the whole contents and return as a string  
  17.             result = reader.ReadToEnd();  
  18.         }  
  19.   
  20.         return result;  
  21.     }  
  22. }  

USING XMLREADER

XmlReader provides fast forward-only access to XML data. It also allows you to read data as simple-typed values rather than strings. XmlReader can load an XML document without having to use HttpRequest, though you won't have the same amount of control over the request. If you use HttpRequest, you can just pass the stream returned by the GetResponseStream() method to XmlReader. Fast write-only functions are provided by XmlTextWriter.
With .NET 2.0 you should create XmlReader instances using the System.Xml.XmlReader.Createmethod. For the sake of compatibility and clarity the next sample uses the .NET 1.1 creation method.

C# XMLREADER SAMPLE

  1. using System.Xml;  
  2.   
  3. // Retrieve XML document  
  4. XmlTextReader reader = new XmlTextReader("http://xml.weather.yahoo.com/forecastrss?p=94704");  
  5.   
  6. // Skip non-significant whitespace  
  7. reader.WhitespaceHandling = WhitespaceHandling.Significant;  
  8.   
  9. // Read nodes one at a time  
  10. while (reader.Read())  
  11. {  
  12.     // Print out info on node  
  13.     Console.WriteLine("{0}: {1}", reader.NodeType.ToString(), reader.Name);  
  14. }  

USING XMLDOCUMENT

XmlDocument gives more flexibility and is a good choice if you need to navigate or modify the data via the DOM. It also works as a source for the XslTransform class allowing you to perform XSL transformations.

C# XMLDOCUMENT SAMPLE

  1. // Create a new XmlDocument  
  2. XmlDocument doc = new XmlDocument();  
  3.   
  4. // Load data  
  5. doc.Load("http://xml.weather.yahoo.com/forecastrss?p=94704");  
  6.   
  7. // Set up namespace manager for XPath  
  8. XmlNamespaceManager ns = new XmlNamespaceManager(doc.NameTable);  
  9. ns.AddNamespace("yweather""http://xml.weather.yahoo.com/ns/rss/1.0");  
  10.   
  11. // Get forecast with XPath  
  12. XmlNodeList nodes = doc.SelectNodes("/rss/channel/item/yweather:forecast", ns);  
  13.   
  14. // You can also get elements based on their tag name and namespace,  
  15. // though this isn't recommended  
  16. //XmlNodeList nodes = doc.GetElementsByTagName("forecast",   
  17. //                          "http://xml.weather.yahoo.com/ns/rss/1.0");  
  18.   
  19. foreach(XmlNode node in nodes)  
  20. {  
  21.     Console.WriteLine("{0}: {1}, {2}F - {3}F",  
  22.                         node.Attributes["day"].InnerText,  
  23.                         node.Attributes["text"].InnerText,  
  24.                         node.Attributes["low"].InnerText,  
  25.                         node.Attributes["high"].InnerText);  
  26. }  

Using XPathNavigator/XPathDocument

XPathDocument provides fast, read-only access to the contents of an XML document using XPath. Its usage is similar to using XPath with XmlDocument.

C# XPATHDOCUMENT SAMPLE

  1. using System.Xml.XPath;  
  2.   
  3. // Create a new XmlDocument  
  4. XPathDocument doc = new XPathDocument("http://xml.weather.yahoo.com/forecastrss?p=94704");  
  5.   
  6. // Create navigator  
  7. XPathNavigator navigator = doc.CreateNavigator();  
  8.   
  9. // Set up namespace manager for XPath  
  10. XmlNamespaceManager ns = new XmlNamespaceManager(navigator.NameTable);  
  11. ns.AddNamespace("yweather""http://xml.weather.yahoo.com/ns/rss/1.0");  
  12.   
  13. // Get forecast with XPath  
  14. XPathNodeIterator nodes = navigator.Select("/rss/channel/item/yweather:forecast", ns);  
  15.   
  16. while(nodes.MoveNext())  
  17. {  
  18.     XPathNavigator node = nodes.Current;  
  19.   
  20.     Console.WriteLine("{0}: {1}, {2}F - {3}F",  
  21.                         node.GetAttribute("day", ns.DefaultNamespace),  
  22.                         node.GetAttribute("text", ns.DefaultNamespace),  
  23.                         node.GetAttribute("low", ns.DefaultNamespace),  
  24.                         node.GetAttribute("high", ns.DefaultNamespace));  
  25. }  

Using a DataSet

Using a DataSet from the System.Data namespace lets you bind the returned data to controls and also access hierarchical data easily. A dataset can infer the structure automatically from XML, create corresponding tables and relationships between them and populate the tables just by calling ReadXml().

C# DATASET SAMPLE

  1. using System.Data;  
  2.   
  3. public void RunSample()  
  4. {  
  5.     // Create the web request  
  6.     HttpWebRequest request   
  7.         = WebRequest.Create("http://xml.weather.yahoo.com/forecastrss?p=94704"as HttpWebRequest;  
  8.   
  9.     // Get response  
  10.     using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)  
  11.     {  
  12.         // Load data into a dataset  
  13.         DataSet dsWeather = new DataSet();  
  14.         dsWeather.ReadXml(response.GetResponseStream());  
  15.   
  16.         // Print dataset information  
  17.         PrintDataSet(dsWeather);  
  18.     }  
  19. }  
  20.   
  21. public static void PrintDataSet(DataSet ds)  
  22. {  
  23.     // Print out all tables and their columns  
  24.     foreach (DataTable table in ds.Tables)  
  25.     {  
  26.         Console.WriteLine("TABLE '{0}'", table.TableName);  
  27.         Console.WriteLine("Total # of rows: {0}", table.Rows.Count);  
  28.         Console.WriteLine("---------------------------------------------------------------");  
  29.   
  30.         foreach (DataColumn column in table.Columns)  
  31.         {  
  32.             Console.WriteLine("- {0} ({1})", column.ColumnName, column.DataType.ToString());  
  33.         }  // foreach column  
  34.   
  35.         Console.WriteLine(System.Environment.NewLine);  
  36.     }  // foreach table  
  37.   
  38.     // Print out table relations  
  39.     foreach (DataRelation relation in ds.Relations)  
  40.     {  
  41.         Console.WriteLine("RELATION: {0}", relation.RelationName);  
  42.         Console.WriteLine("---------------------------------------------------------------");  
  43.         Console.WriteLine("Parent: {0}", relation.ParentTable.TableName);  
  44.         Console.WriteLine("Child: {0}", relation.ChildTable.TableName);  
  45.         Console.WriteLine(System.Environment.NewLine);  
  46.     }  // foreach relation  
  47. }