Tuesday, August 25, 2015

Adding column in existing XLSTListViewwebpart in Powershell

SharePoint provides an option to show particular list view in another pages. We can able to show this using xsltlistviewwebpart. Most us met a situation to modify the listview after placed this in page. Here, i am going to provide a powershell script for this.

$web = Read-Host "Enter site URL : "

$spweb= Get-SPWeb $web


$list = $spweb.Lists["Your List Name"]
$field = $list.Fields["Column Name"]

$displayPage = $spweb.GetFile("SitePages/Home.aspx");
$wpManager = $spweb.GetLimitedWebPartManager($displayPage,[System.Web.UI.WebControls.WebParts.PersonalizationScope]::Shared)

foreach($webpart in $wpManager.WebParts)

{
 if($webpart.Title -eq "Your webpart title")
    {
        Write-Host "Updating view" -ForegroundColor Magenta
        $lvwebpart = [Microsoft.SharePoint.WebPartPages.XsltListViewWebPart]$webpart
        $lvwebpart.View.ViewFields.Add($field)

        $lvwebpart.View.Update();
        Write-Host "view has been updated" -ForegroundColor Green
    }
}

Monday, August 24, 2015

Show each of these additional fields for Lookup Column in Powershell

SharePoint having an option to get a reference from another list using Lookup column. We can also able to pull some additional column values from the list. We can do this manually while editing the lookup column.


Here, I am going to give a powershell script to enable this

$web = Read-Host "Enter site URL : "
$spweb= Get-SPWeb $web

$listParent = $spweb.Lists["Parent List Name"]
$listChild = $spweb.Lists["Child List Name"]

Write-Host "Applying AddDependentLookup" -ForegroundColor Magenta
#Getting lookup column from child list
$lookupField = $listChild.Fields["LookupField"]
$newField= $listChild.Fields.AddDependentLookup("New Column Name",$lookupField .Id)
$secondary = $listChild.Fields.GetFieldByInternalName($newField)
$secondary.LookupField = $listParent.Fields["New Column Name"].InternalName
$secondary.update()
Write-Host "Applied AddDependentLookup" -ForegroundColor Green 

Tuesday, August 11, 2015

Removing Event Receiver from SharePoint list

Introduction

As we know about event receiver in SharePoint. I am going to share a powershell script which is used to remove an associated Event Receiver

Script 

function RemovingEventReceiver($siteURL ,$listName, $eName)
{
$spweb= Get-SPWeb $siteURL
$list = $spweb.Lists[$listName]

 $noe = $list.EventReceivers.Count

  if ($noe -gt 0)
{
   for( $index = $noe -1; $index -gt -1; $index–-)
   {
      $receiver = $list.EventReceivers[$index] ;
      $name = $receiver.Name
      $typ = $receiver.Type ;
 
      if ($name -eq $eName)  
      {
         $receiver.Delete()
         Write-Host "Event receiver " $name " is deleted from " $listName -ForegroundColor Green
      }
   }
}
}
$web = Read-Host "Enter site URL : "

RemovingEventReceiver $web "YourListName" "EventReceiverName"

Tuesday, August 4, 2015

Color code for Calendar item using Calendar Overlay

Introduction

Some of us tried to make color code for events based on their category. Here i am going to give an idea to achieve this using calendar overlay.

Calendar Overlay

At First, We need to create Calendar list. Then, Create category based views in the list. For example, If we want display the holiday with different color. First we need to create view with holiday category based filter.

Creating View

Do following steps to create category based view
  • Click List Settings
  • Click Create View
  • Select Calendar View
  • Give view name and set filter for category field 
  • Clock OK

Set Calendar Overlay

Here is the steps to set overlay
  • Click Calendar Overlay in ribbon
  • Click New Calendar
  • Give Name of the calendar
  • Choose SharePoint as type of calendar
  • Select the color from dropdown
  • Give view URL as web url of calendar
  • And choose List and List view from dropdown list. Then click OK
Calendar overlay is all set. Now put data with holiday category. We can see the item with purple color code.
Note: There is a duplication in above view. To avoid this set Filter in Calendar view with Category equal to null. Then duplication problem will be solved.




Monday, August 3, 2015

MySite in SharePoint 2013

Introduction

We are going to see about mysite in SharePoint. SharePoint has introduced many feature in it. Let us see one by one.

Features in MySite

MySite is a personal site or individual users of an organization. By default we are having NewsFeed, OneDrive and Sites at top of every page. 


Mysite give users social networking and collaboration features. User can share their interests, projects and useful information.

NewsFeed

Its a default page of mysite. NewsFeed is a social hub where user can see the updates from people, documents, sites and tags. This page will display the recent activities of user's specified colleagues and their interests. The newsfeed page will display the followings,


Following

This tab will display the Conversation, tags, documents of followed users

Everyone

It displays the conversation of everyone in organization

Mentions

It displays the mention of particular user and assigned tasks

Activities

It displays all the activities of user

Likes

It displays the items which is liked by user

I'm Following

It displays the count of People, documents, sites and tags the user following. We can get more details while clicking the numbers.

Trending #tags

It gives the top five # tags.

One Drive

This link redirect us to user's onedrive for business. Onedrive for business is a personal storage. User can able to store their documents and so. We can able to synchronize this with local computer.

Sites

It displays the sites which is followed by user and suggested sites.

About Me

About me is a default page while we are accessing another user's page. This page contains Activities, Edit your profile, In Common and Org Chart.

Blog

Blog is a webpart, it is used to publish the blog by site owner. User can able to customize the page as user want.

Apps

This page will displays the list, libraries and other apps

Tasks

This page will display the tasks which is assigned to user. This page is only visible to Site Owner.

Conclusion

I given some points about mysite in SharePoint 2013. You can get thrill while using those features in mysite.

Happy Learning !!!!