Wednesday, October 3, 2012

SharePoint server is not installed on this computer

Share/Save/Bookmark

Are you victim of this error? then, you must be trying to use SharePoint 2010 templates in visual studio 2010  on the system that does not have Sharepoint installed.

So how to make it work with out installing the SharePoint server on local machine? After googling around, the hack that i found is to export the registry from SharePoint 2010 machine and import it to the machine where you are running visual studio.
Follow the below detailed steps,


  • Run regedit in command prompt on Sharepoint server
  • Navigate to the path [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\14.0]
  • Copy the whole 14 hive registry by exporting it.(File->Export)
  • Open the registry in local machine where you are trying to develop sharepoint solutions using VS2010
  • Export the copied registry (File->Import)
The last step is to copy the SharePoint dlls at C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI from sharepoint server to local machine.
Copy the necessary sharepoint dlls to GAC or use Gacutil to do.
Now after restarting VS you must be able to create projects using sharepoint templates. 
This way i could successfully develop sharepoint solution using  VS2010 when sharepoint is on a different system(in  my case sharepoint online) though debugging is not possible.

Subscribe

Tuesday, September 25, 2012

Query XML using LINQ

Share/Save/Bookmark


I have a scenario, to calculate the size of the documents in library.
Now after i read the library using web service in to xml (soap) i do not want to iterate or loop
all items to read the value in the column,file size. I was wondering if i can apply a aggregate function(sum)
like we have in SQL. Here is how i did with XDocument by applying LINQ on XML

XDocument xDoc = XDocument.Load("test.xml");
// Incase if source is a XmlNode
//Xdocument.Parse(XmlNode.OuterXml);
//namespace is always necesary for xdoc to identify the elements
XNamespace z = "#RowsetSchema";
var size = (from item in xDoc.Descendants(z + "row")
             select Convert.ToDouble(item.Attribute("ows_File_x0020_Size").Value.Substring(item.Attribute("ows_File_x0020_Size").Value.IndexOf('#') + 1))).Sum();

XDocument.Descendants("z:row") will always throw exception that semicolon is not allowed.
Thats one more reason why namespace should be passed.



Subscribe

Sunday, September 9, 2012

component version is not compatible with the search database

Share/Save/Bookmark

One of the reason for causing the below error is due to missing database upgrade in the server for search service application.

ERROR :The synchronization operation of the search component: 8bce98fb-8409-491d-877e-143590c9f055 associated to the search application: Search Service Application on server: has failed. The component version is not compatible with the search database: Search_Service_Application_CrawlStoreDB_4925b8b4b5574940ba8389bffd59423f on server: . The possible cause for this failure is The database schema version is less than the minimum backwards compatibility schema version that is supported for this component. To resolve this problem upgrade this database..


In order to update the SharePoint databases, you must manually run the PSconfig utility. To run the utility:
Check if the server needs update with the following command in the sharepoint powershell admin,

(get-spserver $env:computername).NeedsUpgrade

If it returns TRUE, then follow the steps below

1.Open an Administrative command prompt.

2.Change directory to C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\BIN

3.Run PSConfig.exe -cmd upgrade -inplace b2b -force -cmd applicationcontent -install -cmd installfeatures

This will take couple of minutes to finish.


Subscribe