SharePoint 2013 Preview developer documentation

Get your first look at the developer features for the latest release of SharePoint, SharePoint 2013 Preview. Get detailed technical information on what’s new, including an in-depth introduction to apps for SharePoint; learn how you can now build a new class of apps that extend and personalize the way we create and consume information.

More details : msdn.microsoft.com/en-us/library/sharepoint/jj162979(v=office.15)

Life In SharePoint – Metro UI Masterpage

SharePoint 2010 Masterpage design is inspired from the Metro UI of Windows 8. The design has the following features:


Fixes : Chrome Support, Wrapping Navigation, Repositioned Search Box
Liquid Layout
Cufon Integration
Jquery Accordion Quicklaunch with Sub Item Count
Full Solution with single Site Feature to activate branding (Thanks CKS:Dev Team)

Know more : Life In SharePoint – Metro UI Masterpage .

WebPart Collector

Have you ever imagined of finding a webpart in the site collection you have deployed ? May be you need to know which all pages gets affected when you remove a particular webpart.

WebPart Collector or finder as you can say, is a new community addition which does that exactly. You can find it in webpartcollector.codeplex.com

WebPart Collector basically contains the logic to traverse and display all aspx pages within the current site collection and deploys jquery files and images into your layouts folder to have that tree structure while exploring.

This will help you identify all the web parts that are located in each page inside your site collection.

Install the WSP and make sure the WebPart collector feature is activated.

Now, edit a page and add the webpart collector web part into the page. You will get a view similar to something below which would track all the web parts within the site collection. The root tree nodes will have the title of the document library and it expands to show the pages within the library on which the webparts are found.

There are many options that can be selected to view the webparts. You can either select only the custom web parts in pages or web parts added in pages that are in the quick launch.

Your feedback and suggestions are always welcome. :)

Starter Corev4 CSS for SharePoint

Most of us have come across Starter.master or Starter Master Pages in CodePlex created by Randy Drisgill.

“Starter Master Pages for SharePoint are a clean, commented starting point for creating your own SharePoint 2010 branding”

— Thanks to Randy Drisgrill for such an informative contribution.

Inspired from Starter.master, evolved StarterCorev4.css which gives you detailed description about the Corev4.css file that comes within SharePoint 14 hive.

Corev4.css – Corev4.css is the core style sheet that is shipped within the 14 hive (%Program Files%\Common Files\Microsoft Shared\Web Server Extensions\14) of SharePoint, which is referred by default in all SharPoint OOTB( Out of the Box) controls.

StarterCorev4.css file when attached to your Master page, will enhance your Master page css reading capabilities and is NOT intended to override any class files for SharePoint for development. Clicking on any of the css class links in the Master page will lead you to the class definition in the css file. Follow the below steps to include StarterCorev4.css

1. Open and Edit your custom master page in SharePoint Designer.

2. Download StarterCorev4.css from CodePlex – http://startercorev4.codeplex.com

3. Either upload the css file into your Site Style library or keep it in a local file location for reference.

3. Attach the downloaded StarterCorev4.css into the head section of your master page as shown below.

4. Notice that a tag has been added to the head section with the path of the css file.

5. Now Clicking on any of the css class defined in your master page, which usually refers to Corev4.css would redirect to the class files in StarterCorev4.css (Use Ctrl + Click for redirection). For eg:- I have clicked on the id “s4-ribboncont” defined for the ribbon, which leads me to an explanation as below.

After all your development activities and css changes for the master page and before moving the custom master page for deployment or testing, you should remove the reference link added on the head section of your master page for StarterCorev4.css. This would revert the usage of StarterCorev4.css file to the default corev4.css file in the 14 hive.

NOTE : You should never modify your Corev4.css file in the 14 hive which comes by default with SharePoint. Follow the best practices in over riding the default SharePoint css references.

Watch out the codeplex page for updates and improvements to the StarterCorev4.css project. Your feedback and comments are much appreciated.

CSS Style Switcher for SharePoint Master page

I recently went through a CSS Style switcher article done in JQuery and PHP – http://net.tutsplus.com/tutorials/javascript-ajax/jquery-style-switcher/

Here is the online demo for the style switcher which looks pretty neat – http://demos.net.tutsplus.com/03_jQueryStyleSwitcher/demo/

Click on Day and Night tabs to switch over the effects. You can notice that the jquery fading effect makes it a perfect switching.

Now, why don’t we have the same in SharePoint for our Master Pages. This would be an excellent add-on for sites that need Accessibility features, basically style sheet switching for people who are color blind. You will be able to understand it better visiting this BBC site – http://www.bbc.co.uk/accessibility/index.shtml .

On the top right hand side of the page, you can see icons where it mentions diferent colours possible for the site dynamically.

Click on the icons and you will notice what I meant. These are one of the accessibility feature that I was talking about

Ok, Now how about adding all these into a SharePoint master page, so that you can switch your styles dynamically on a button click.

1. First of all, you need to upload the jquery.js and the styleswitcher.jquery.js file into the SharePoint Style library. Download all the files at the bottom of the post. Also add the loading.gif file into  the path - /Style Library/Images/ inside your root site.

2. Add the js file references in the head section of your master page.

[sourcecode language="xml"]
<script src="/Style Library/en-us/js/jquery.js" type="text/javascript"></script>
<script src="/Style Library/en-us/js/styleswitcher.jquery.js" type="text/javascript"></script>
[/sourcecode]

3. Add the div tags in your master page. As a demo, you can add the div inside the PlaceHolderPageDescription, just below the s4-pagedescription css class. This will be added in your master page just below your Site title. Make sure that the div id name is style-switcher always, or you will have to change the final call in Step 5.

The css classes whiteandblue.css and blackandyellow.css should be added in the path - /Style Library/en-us/Core Styles/ in your SharePoint site. These styles are the one that will be switched finally.

[sourcecode language="xml"]
<div id="style-switcher">
<h4>Choose your style:</h4>
<ul>
<li id="day"><a href="" name="whiteandblue.css">White and Blue</a></li>
<li id="night"><a href="" name="blackandyellow.css">Black and Yellow</a></li>
</ul>
</div>
[/sourcecode]

4.  Now its the main script that is called within the styleswitcher.js file. The function onClickStyleChange below adds the css link for the master page. This is the place where the switching takes place.

[sourcecode language="xml"]
<script type="text/javascript">
function onClickStyleChange(strvalue)
{
var headID = document.getElementsByTagName("head")[0];
var cssNode = document.createElement(‘link’);
cssNode.type = ‘text/css’;
cssNode.rel = ‘stylesheet’;
cssNode.href = ‘/Style Library/en-us/Core Styles/’ + strvalue;
cssNode.media = ‘screen’;
headID.appendChild(cssNode);
}
</script>
[/sourcecode]

5.  Add the below script in the master page which ultimately calls the function inside the jquery. This gives the fade in and fade out effect for our master page which is really cool.

[sourcecode language="xml"]
<script type="text/javascript">
$(‘#style-switcher a’).styleSwitcher(); // Calling the plugin…
</script>
[/sourcecode]

6. Save, checkin and publish your master page. You are good to go.

For convenience I have zipped all the necessary js files and loading.gif file over here. Special thanks to the person who initially created this in Php.

SharePoint 2010 101 Code Samples

Each code sample is part of the SharePoint 2010 101 code samples project. These samples are provided so that you can incorporate them directly in your code.

Each code sample consists of a standalone project created in Microsoft Visual Studio 2010 and demonstrates a distinct feature or feature set. Each sample includes comments describing the sample and the expected results. Each sample also contains comments that explain how to set up your environment so that the sample code runs, where necessary.
Read more and download the code samples from here.

Creating a Search Content Source of type Web using PowerShell

The New-SPEnterpriseSearchCrawlContentSource command in Powershell is used to create a new crawl content source for a SharePoint search application.We can view the whole set of parameters and options in this msdn article.

So , when we need to create a SharePoint Search content source, using Powershell, we use the following commands-

[sourcecode language="xml"]
$searchapp = Get-SPEnterpriseSearchServiceApplication "Search Service Application"
New-SPEnterpriseSearchCrawlContentSource -SearchApplication $searchapp -Type SharePoint -name ContentSourceWithTypeSharePoint -StartAddresses http://localhost:6001/
[/sourcecode]

This would create a content source

Clicking on the “ContentSourceWithTypeSharePoint” would open up the content source which we have created using the default settings as below:

This was a simple scenario. Now consider creating the content source of type “Web” which would be

[sourcecode language="xml"]
$searchapp = Get-SPEnterpriseSearchServiceApplication "Search Service Application"
New-SPEnterpriseSearchCrawlContentSource -SearchApplication $searchapp -Type Web -name ContentSourceWithTypeWeb -StartAddresses http://localhost:5000/
[/sourcecode]

And this would create a content source with type “Web” as below

Here, we can see that the crawl behavior is set to custom and there would be no direct parameters in Powershell to change these options.

So, I recently had a research into this and found out that adding the parameters, MaxPageEnumerationDepth and MaxSiteEnumerationDepth , could bring you these options.

ie, To bring the crawl option to the second option -”

[sourcecode language="xml"]
$searchapp = Get-SPEnterpriseSearchServiceApplication "Search Service Application"
New-SPEnterpriseSearchCrawlContentSource -SearchApplication $searchapp -Type Web -name ContentSourceWithTypeWeb -StartAddresses http://localhost:5000/ -MaxPageEnumerationDepth 0 -MaxSiteEnumerationDepth 0
[/sourcecode]

This actually means that the Page depth and the Site depth that you expect is zero, which defaultly means that you would be crawling only the first page of your start address and hence this option is selected.

and to bring the crawl option to the first option -”

[sourcecode language="xml"]
$searchapp = Get-SPEnterpriseSearchServiceApplication "Search Service Application"
New-SPEnterpriseSearchCrawlContentSource -SearchApplication $searchapp -Type Web -name ContentSourceWithTypeWeb -StartAddresses http://localhost:5000/ -MaxSiteEnumerationDepth 0
[/sourcecode]

This actually means that the Site depth that you expect is zero and it can go any pages deep if it is within the server, which definitely means you would be crawling only within the server of the start address.

This post was inspired from a question asked in SharePoint.Stackexchange.com - http://sharepoint.stackexchange.com/questions/27901/how-to-create-a-content-source-of-type-web-with-the-option-only-crawl-within/27908#27908

Clean Up Customized CSS Files with CSSCompare

Have you ever come across a SharePoint installation that’s been customized in an unsupported way? You look at the 12 (or 14) hive and see that files have been modified by hand? Not good.

As you may know, changing core SharePoint files is unsupported and can lead to problems when patching.

The best way to clean up modified SharePoint installations is to pull out the customizations and move them into new files as part of a solution package (WSP file). That makes it easy to re-deploy customizations and ensures your environment will stay clean.

Read more here and download CSSCompare here.