Showing posts from April, 2012

SharePoint 2010 SPQuery, SPSiteDataQuery and CrossListQueryInfo

SharePoint 2010 Querying Data

SPQuery ClassSPSiteDataQuery ClassCrossListQueryInfo* Class

SPQuery Class used for query a data from a specific list and also used for join two lists.

SPSiteDataQuery: this class used for cross site query. Query a data within site collection or specific web.

Microsoft Definition:
You can use an instance of this class to retrieve data from selected lists or from all lists in the current site collection. Specify the scope of the query by setting the Webs property. Specify the lists to participate in the query by setting the Lists property and the fields to return by setting the ViewFields property. Control data selection and order by setting the Query property.

CrossListQueryInfo* (SharePoint Server) : This class only available in SharePoint Enterprise addition. For this you have to include Microsoft.SharePoint.Publishing namespace.

Microsoft Definition:
The CrossListQueryInfo object uses the CrossListQueryInfo object to get the cached results or, if there are…

SharePoint 2010 Hide Ribbon button using CSS

Use any Element inspector to find the id of the ribbon button. Use “\” backslash to escape period “.” Apply class in master page.  Example

Before List Item Ribbon

To Hide New List Item #Ribbon\.ListItem\.New\.NewListItem-Large{Display:none;}
To hide New item group.  #Ribbon\.ListItem\{display:none;}
To hide Delete button  #Ribbon\.ListItem\.Manage-LargeMedium-1-2{Display:none;}

To Hide List Manage Group#Ribbon\.ListItem\.Manage { display:none; }

SharePoint 2010 Sandbox serialize & Deserialize the data to JSON

My requirement to serialize strongly typed data (settings) that I will used for later used. But sandbox will not allow us to serialize the data and store into the file. we can't store the file into the file system but we can create the hidden document library(lets say "mydoc" as used in the below example)  in SharePoint we can store over there.

Found the work around
1.JavaScriptSerializer Class its provide the way to serialized the data into JSON. 2.I used this class and serialized the data into JSON. 3.Then I Created the Hidden Document library and store serialized data into in this document library. 4.Whenever I required this setting read the information form that file as string and Deserialize that string into strongly typed data.

Following an example  
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Web.Script.Serializat…

SharePoint 2010 WSP Deployment

Power Shell
Add SolutionFarm Add-SPSolution –LiteralPath "C:\PoweShell\MyPowerShellPackage.wsp"
Sandbox Add-SPUserSolution –LiteralPath "C:\ PoweShell\MySharePointSolutionPackage.wsp" –Site http://webapplication/sitecollectionInstall SolutionFarm  Install-SPSolution –Identity MySharePointSolutionPackage.wsp –WebApplication http://webapplication –GACDeploymentSandbox Install-SPUserSolution –Identity MySharePointSolutionPackage.wsp –Site http://webapplication/sitecollectionUpdatingFarm  Update-SPSolution –Identity MySharePointSolution.wsp –LiteralPath “C:\Deployment\MySharePointSolutionPackage.wsp” –GacDeploymentSandbox Update-SPUserSolution –Identity MySharePointSolution.wsp –Site http://webapplication/site –ToSolution MySharePointSolutionPackage.wspUninstalling 
Farm  Uninstall-SPSolution –Identity MySharePointSolution.wsp –WebApplication http://webapplication
Sandbox  Update-SPUserSolution –Identity MySharePointSolution.wsp –Site http://webapplication/site –ToSolution…