Saturday, October 20, 2012

SharePoint 2010 calendar color indiacator using Overlays

Hi Guys,

Recently I got a requirement from my team to develop vacation calendar along with color indicators for each category.

Later started search, I found many good articles on the internet, but I want to finish through OOTB. So I got the below method to work exactly and writing down the below  lines to be helpful for others and for my own tracking .

Step1: Create one calendar list and name it as vacation calendar. Once created, go to settings and then change category choice items. Add your own categories upto 7 ( as OOTB offers not more than this colors).  For e.g. I created 3 categories named "Vacation", "Training", "Work from Home"

Step2: Create a new calendar view named Vacation view and specify Category is equal to Vacation in filter section.

Step 3: Create other 2 views like in step 2 with specifying categories is equal to their category values.



Step 4: Create a new view name Overlay view and specify Category is blank in Filter section..




Step 5: Create Overlay view as the default view and click on Overaly button in ribbon.



Step 6: Create new calendar link in Overlay section and specify names and select appropriate site with click on resolve button.

Specify the color from the list and fill the remaining details.


Check Always show check box.
Step 7: Create another two calendar in Calendars Overlay section using above step for other two cateogories.

Thats it. Try adding different entries with various categories and you can find different colors. Make sure Overlays view is your default view, so that when you add it as list view webpart, make sure to change the view to Overlay view in tool bar setting.


You would get final look and feel like this,




Cheers,
Anil

Sunday, October 14, 2012

Powershell startup

Hi Guys,

I started learning powershell scriping recently and I noted my learning updates here for quick reference

  1.  To add powershell snap-in
           Add-PSSnapin Microsoft.Sharepoint.Powershell

If you are unable to add snapin to the powershell console, you may not have sufficient permissions to do the scripting.

Here are the steps to get the permissions to run the scripts.

You should have access to sharepoint shell configuration database and here is the cmdlet.

Add-SPShellAdmin -username contoso\user1

You have to perform the above step by using farm administrator privileges. The above command adds the user name specified to the Sharepoint_shell_access role on the configuration database.

If you want to give permission to a specific content database for a webapplication, specify the database parameter
Add-SPShellAdmin -username contoso\user1 -database guid



   2.    To get help on any command,
           help Get-SPSite

    3.   To get examples on the cmdlet.

          Get-SPSite -examples

4.        To get information about the site,

          Get-SPSite http://litware | select owner, Name, Description

5.       To know about the features in a site collection

         Get-SPFeature -site http://litware
6.      To activate the features

         Enable-SPFeature -identity GUID -url http://litware

7.    To install the feature,

        Install-SPFeature featurename
        e.g Install-SPFeature  MyCustomFeature
       Before installing the feature, make sure that, the feature files are deployed correctly in 14 hive features    folder.

8.     To add the solution to the farm,
       Add-SPSolution solutionname
       e.g. Add-SPSolution  "D:\mycustomsolution.wsp"

9.    To deploy the solution to the GAC
        Install-SPSolution -identity mycustomsolution.wsp -webapplication http://litware  -GACdeployment

 10. To update the solution
       Update-SPSolution -identiy mycustomsolution.wsp -literalpath "d:\mycustomsolution.wsp" -GACdeployment

11. To uninstall the solution from the web application
      Uninstall-SPSolution -identity mycustomsolution.wp -webapplication http://litware

12. To remove the solution from farm
      Remove-SPSolution -identity mycustomsolution.wsp

Below is the example
Powershell script to install a feature for all the site collections in a farm with known GUID

Add-PSSnapin microsoft.sharepoint.powershell
$webapplications=Get-SPWebapplication
foreach($webapp in $webapplications)
{
$id=$webapp.id;
write-host "processing webapplication with name, id" + $webapp.Name, $id

foreach($site in $webapp.Sites)
{
$name=$site.Name;
write-host "processing site collection -" + $name
foreach($web in $site.AllWebs)
{
write-host "processing web" +$web.title
$features=$web.features;
if($web.features[GUID] -eq $null)
{
enable-spfeature -identity GUID -url $web.url -confirm:$false
}

}
}

}