Fixing blank lookup columns in SharePoint when creating new site from a site template

One of the common issues when creating a new site from a site Template is that the lookup columns values are blanks. The full scenario is as below :
  • Create a SharePoint site
  • Add lists with lookup columns
  • Insert some data in the lists
  • Save the site as Template with its content
  • Create a new site from the Template
When you access the list which contains the lookup column, you will notice that the lookup values are empty. The lookup values still exist but they are not rendered. We have to fix the list schema by updating some properties of the lookup column. Two properties have to be updated :
  • The Web Id
  • The List Id
There are two ways to fix the list schema :
  • Using C#
  • Using Powershell
We will see how to fix the error using Powershell. The script below will let you fix the column.

$web = Get-SPWeb "Your web url"
$list = $web.Lists["Your list name"]
$column = $list.Fields["Your column name"]
$lookupList = $web.Lists["Your source list name"]
#Updating the column properties
$column.SchemaXml = $column.SchemaXml.Replace($column.LookupWebId.ToString(), $web.ID.ToString())
$column.SchemaXml = $column.SchemaXml.Replace($column.LookupList.ToString(), $lookupList.ID.ToString())
$column.Update()
write-host "Column properties have been updated"
$Web.Dispose()
  
More details about the lookup columns on MSDN.



 

Fixing Error : GetUserListSchema(): Failed to get the list schema XML for feature

One of the common error that you may encounter when you try deploy a SharePoint solution is :

Error 36 Error occurred in deployment step 'Activate Features': Cannot complete this action.
Please try again.

After analyzing the SharePoint log files I found out the error bellow :

GetUserListSchema(): Failed to get the list schema XML for feature

The error above has been caused by the manipulation bellow :

In this project I had only one feature that contained the list definition and the list instance and then I have created a new feature scoped site and move the list definition to it. I kept the list instance in the scoped web feature.

In order to fix the problem, you have to edit the element.xml of the list instance and add the featureid attribute. The feature id attribute should be the id of the list definition's feature.

Here is a sample element.xml file.


<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="
http://schemas.microsoft.com/sharepoint/">
  <ListInstance Title="ListInstanceName"
                OnQuickLaunch="TRUE"
                TemplateType="10000"
                FeatureId="644d32f3-30d8-441f-a24c-84cd3931cdf0"
                Url="Lists/ListInstanceName"
                Description="My ListInstanceName">
  </ListInstance>
</Elements>

SPCAF : A very useful code analysis tool for SharePoint

In the last 5 days, my mission was to analyze a set of SharePoint solutions that was developed during 6 months and to write a document that lists things that should be fixed or enhanced. Usually, my analysis tasks is based on FxCop,SPDisposeCheck and Source code analysis. This time i've googled a littled bit in order to see if there is a tool that could help me automating my task. After 2 minutes of search, i found a tool in Microsoft Visual Studio Gallery called : SPCAF (SharePoint Code Analysis Framework).It is still in BETA version.

SPCAF cannot only analyze assemblies like other tools as FxCop or SPDisposeCheck. It can also analyze all the XML code in SharePoint packages like Features, ContentTypes, ListTemplates and all the other files like controls (.ascx), pages (.aspx) and master pages (.master) etc.

The tool can be run in 5 different modes :

  • Integrated with visual studio 2012/2010
  • Client application
  • Integrated into a Team Build
  • Command line
  • MSBuild Task
Client Application

Integrated with Visual Studio

SPCAF client application is able to analyse SharePoint solution without the need of source code. You'll have to use the WSP files as an input to SPCAF. Differents analysis rules are available. 
SPCAF generates 4 types of reports :
  • Rules Report
  • Code metrics Report
  • Dependencies Report
  • Inventory Report
It is amazing how the tool is useful. One of the best advantages of this tool is that it doesn't only tell what's wrong but also how to fix that error.

Great thanks to Torsten Mandelkow and Matthias Einig :)



Upgrade from SharePoint 2010 to SharePoint 2013



The upgrade from SharePoint 2010 to SharePoint 2013 can only be done using the Database-Attach method. 
The upgrade process is composed by three steps : 
  • Prepare for upgrade
  • Upgrade Database
  • Upgrade Sites


Click here to view the SharePoint 2013 Upgrade process

PREPARE FOR UPGRADE

PLAN FOR UPGRADE


PREPARE 2013 FARM (See msdn)


Phase 1 of the upgrade process: Create SharePoint 2013 farm

UPGRADE DATABASES


  • Upgrade services applications to SharePoint 2013 (See msdn)
  • Upgrade Content database (See msdn)
  • Verify upgrade for databases (See msdn)
  • Migrate from classic-mode authentication to claim-based authentication (See msdn)


UPGRADE SITE COLLECTIONS

Latest Office & SharePoint Videos

Microsoft Tech·Ed Online Latest Office & SharePoint Videos

This track enables IT professionals to learn about Office server and client applications via sessions covering security, deployment, management, customization, and administration. It also enables developers to learn how to leverage their ASP.NET expertise within the SharePoint ecosystem, craft the next generation of “Office Business Applications”, creating applications involving Microsoft Office, composition, collaboration, software-plus-services, VOIP, Open XML, Silverlight™, and more!
 
To Read the full article click here

Integrating Mobile Client Applications with SharePoint 2010 Workflows

Integrating Mobile Client Applications with SharePoint 2010 Workflows

SharePoint 2010
Published: November 2010
Summary: Learn to integrate mobile devices with Microsoft SharePoint Server 2010. Learn to create a Windows Presentation Foundation (WPF) application that calls a Windows Communication Foundation (WCF) service to submit data into a SharePoint site and update the status of a custom SharePoint workflow.
Applies to:    Microsoft SharePoint Foundation 2010, Microsoft SharePoint Server 2010 | Provided by:   MVP ContributorTodd Baginski, SharePoint Server MVP, Aptillon
Contents
  • Integrating Client Applications with Business Processes
  • Introducing the Sample Scenario
  • Building the Mobile WPF Client Application
  • Creating the WCF Service
  • Deploying the Mobile Client Application and Other Components
  • Debugging the Solution Components
  • Conclusion
  • Additional Resources
Click to grab code  Download the sample code

Integrating Client Applications with Business Processes

Recently mobile devices have become more powerful and easy to use. Rugged laptops, netbooks, tablet PCs, and mobile phones are relied upon to provide workers access to the information and applications that they must have to do their jobs. Additionally, developing applications for mobile devices is now easier than ever. As a result, more and more often business scenarios demand integrating client applications together with business processes and workflows. This article is part of a series of articles that describe how to integrate client applications together with business processes and workflows:
  • Integrating Mobile Client Applications with SharePoint 2010 Workflows
  • Creating and Publishing Excel 2010 Documents with Custom SharePoint 2010 Workflows
  • Integrating Custom Silverlight Applications with SharePoint Server 2010
Microsoft SharePoint Foundation 2010 and Microsoft SharePoint Server 2010 provide workflow capabilities that enable you to model business processes and integrate them with multiple applications and systems. You can create client applications to extend reach of the workflow and make it available outside the context of SharePoint sites. Creating client applications to access workflows in SharePoint sites requires a client application, networking (services), and integration with SharePoint lists and workflows.


To read the full article click here

Steps to Install SharePoint 2010 bootable VHD machine


Steps to install SharePoint 2010  VHD machine !
Pre-requisites :
- Windows seven installed on the host machine
- Windows server 2008 R2 installation media
- SQL server 2008 SP 1 with hotfixes
- SharePoint 2010 installation media
- Visual studio 2010
- Create VHD Disk using the Computer management->Disk management . set the disk size to fixed size and to 30GB.
- after creating the VHD disk using the disk management of the computer management tools , you have to initialize the disk.
- Just click click on the case where the disk name is Shown [the small case] and then select initialize. in the intialize screen select "Mbr boot" and then click ok.
- Now quick format the disk. "file system should be NTFS"
- Mount the VHD and select V: as drive letter
- Download the install-windowsImage.ps1 from http://code.msdn.microsoft.com/InstallWindowsImage  . right click on the ps file and then select properties and click unlock. this will allow you to execute the Powershell script.
- Open cmd with administrator privilege and the tape : powershell
- tape set-ExecutionPolicy RemoteSigned   " this will allow you to execute unsigned ps script"
- go to the directory where you've download the script and then tape the following command : 
      .\Install-WindowsImage.ps1 -WIM [Drive]:\sources\install.wim
 >> [drive] should be replaced by the disk drive where you've mounted the Server 2k8 R2 media
- Now note the index number of the installation type you want to accomplish. >> 3 for the Full installation of Enterprise edition . do not type the []
- now type :
.\Install-WindowsImage.ps1 -WIM [Drive]:\sources\install.wim -Apply -Index [IndexNumber] -Destination V:

[IndexNumber] Should be replaced by the index number of the installation type you want to accomplish.

-  Wait 15 minute for the process to finish.
- Now open cmd again with administrative rights and type :

V:\Windows\System32\bcdboot V:\Windows

Now you can boot on your newly created VHD Machine .

- Next steps are :
  • Installation of SQL Server 2008 SP1
  • SharePoint 2010
  • Visual studio 2010


.