Saturday, January 19, 2013

How to hide recently modified documents in the masterpage

Hi All, Just want to note my small work on hiding recently modified document link in the sharepoint site. If you want to do it for all pages in the site, go to master page of the site using designer and write the below css snippet in the head tag. If you want to hide the same for a particular home page only, add the same css in CEWP webpart.

Hide fields in the list view web part using jquery

Hi Guys,

I had a requirement to hide the list fields in the list view web part.

For example, in a workflow, I have a course training custom list with multiple columns, where the students want to enter their data like name, course required, timings etc and course  faculty need to see additional fields like approved/rejected, his availability etc.

For students, they should not see approved column while they submit the course request.

This could be possible through  a simple j query, in a content editor web part with specifying target audience.

Here is the jquery code.

$('nobr:contains("Approved")').closest('tr').hide(); //"Approved" is your required column to hide.

The code works like this
When you go to view source of the page, you could see the fields names with the tag "nobr" associated to it. So query those tags with jquery selector and hide its nearest 'tr'.

So if the above code does not work for you, make sure  to check the view source of the page and see the field name tags.


Thursday, November 1, 2012

SharePoint 2010 Birthday webpart

Hi ,

I had a small requirement from my manager to display the team mates birth days in the team site for the current month.

I searched for the  already existing solutions in the net and able to replicate one of them using a simple OOB approach.

You just need a custom list to store the team mates names and birth day dates and need to do some calculated columns . Thats enough.

Below are the steps explained.

  1. Create a custom list named TeamBirthdayList and add the columns name, birthday as date type and other details if needed to display like mail id and mobile no.
  2. create a column named "currentdate" and make default value as today's date with date only.
  3. Create two calculated columns named "startmonth" and "endmonth".
  4. startmonth calulated formula as DATE(YEAR(currentdate),MONTH(Birthday),1)
  5. endmonth calulated formula as DATE(YEAR(currentdate),MONTH(Birthday)+1,1)-1.
  6. Now create another column named "BirthdayOrder" as calculated column to sort the list according to the date. the formula will be like this : DATE(YEAR(currentdate),MONTH(birthday),DAY(birthday))
  7. Now, add this list as listview webpart in the page and change the view settings like below steps. 
  8. Sort the items as per birthday order field .
  9. IN the filter section, startmonth is less than or equal to [Today] and endmonth is greater than or equal to [Today]
Thats it. your teams birthday webpart is ready and you can customize the styles using xslt.

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
}

}
}

}

Sunday, August 26, 2012

Configuration of SharePoint workflow tasks in Outlokk

When you work with approval workflow in SharePoint 2010 and trying for do approval/reject for the workflow throug Outlook, you may face the problem of trusted sites security issue and not able to do approval/reject of the workflows,

Below are the steps to resolve these issues.

1. Out look sharepoint configuration

1. In SharePoint site, Go to “Tasks” list.


2. On the top ribbon, click on “List” tab and then click on “Connect to Outlook”. Below is the screen shot.







3. After the above step, click on “Yes/Allow program” for the windows prompt messages.

4.  open your internet explorer then  Click on internet tools --> Options --> Security tab


5. Click on “Trusted sites” and enter the sharepoint ur and then click ok.








SharePoint 2010 OOB approval workflow customization


Hi Guys,

Recently I worked on a requirement to customize the OOB approval workflow in sharepoint designer.

The customer is looking for the  email customization at each stage of the approver  and the workflow initiator.

For e.g., if there are two approvers sequentially and if the approver approves the task, then second approver should know that the document was initially approved by first approver and waiting for the current approval from him self and similar notification to workflow initiator so that the initiator can contact drectly the pending approver to get task immediately.

Below are the steps, I implemented in SharePoint Designer   for acheivimg this customization.

Go to SP designer and open the workflows section of the site.

Select Approval workflow and do right clcik and then do copy and modify option.

After that paste the work flow and change the title and desctiption as required.

Once it it ready, click on Edit Workflow link and then click on the associate workflow part.

image comes here

Here you find 4 links to modify the task options like "Change the behaviour of the single task" , "Change the behaviour of overall task process" etc.

Click on "Change the behaviour of single task" and then do check for the different conditions about the task.

Go to the condition "if task Extenal participant is empty". there is already existing notiffication email action available, Do modify that with your content.

image comes here.

You can address approver  dsiplay name, document link can be embedded here, "Open this task"  link can be added inside the mail body.

image comes here.

Similary if you want notify the initiator about the task approvers, add the similar email action below this and customize the email body accordingly.

image comes here.

Once the approver do the approval/rejection, he can be notified through mail saying that the document is approved/rejected.

This can be done with adding email condition in the below way.

image comes here.