Tuesday, May 19, 2015

What's happening webpart is showing incorrect value in community site SharePoint 2013

Introduction

Most of us came across about this issue, which is count of Members, Discussion and Replies. Normally, These values are tracking in properties. In Some cases, It will not update properly. Let see how to update this.


Community site properties 

Open your community site in SharePoint Designer. Click Site options in top ribbon



Then we can able to see the parameters (properties) of site.


We can find the Community_MemberCount there, which is used to keep member's count of community.

Update the properties using Event receiver

We need to update the property when the user has leave from Community Member list. So, I have written the code in Community Member list event receiver to update the property. Members are not deleted from the list. They have changed the flag when user enforced to delete. So we need to code it when ItemUpdated


public override void ItemUpdated(SPItemEventProperties properties)

        {

            var web = properties.Web;

            var currentAllowUnsafeUpdatesVal = web.AllowUnsafeUpdates;
            try
            {
               var membersCountQueryCAML = "<Where><Eq><FieldRef Name='MemberStatusInt' /><Value Type='Integer'>1</Value></Eq></Where>";
            var membersCountQuery = new SPQuery();
            membersCountQuery.Query = membersCountQueryCAML;
            
                var membersCount = membersList.GetItems(membersCountQuery).Count;
                web.AllowUnsafeUpdates = true;
                if (web.AllProperties.ContainsKey("Community_MembersCount"))
                {
                     web.AllProperties["Community_MembersCount"] = membersCount.ToString();
                    web.Update();
                 }
                base.ItemUpdated(properties);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                web.AllowUnsafeUpdates = currentAllowUnsafeUpdatesVal;
            }
        }

Then, deploy / upgrade your solution in your community site. Now Whats happening webpart will give the correct member's count.

Increase the Social Comment Webpart (NoteBoard) item count

Introduction

As all we know, We have Noteboard webpart in SharePoint which is used to comment about particular page. Refer this blog for get intro about it. 

The items count of this webpart is set as 3 by default. We can able to change it as we wish.



        <prfx:SocialCommentWebPart runat="server" ChromeType="TitleOnly" Title="Comments" WebPartPropertyDisplayItems="10" />

Set WebPartPropertyDisplayItems with the count which you want.  That's all Noteboard webpart will display number of items which you gave.

Sunday, April 19, 2015

Delete custom Timer job in SharePoint using powershell

Introduction

Everyone is experiencing the situation to delete the timer job from CA. Here, i am providing an example to delete it using powershell command.

Get-TimerJob | where { $_.name -like "*your timer job name*" } | ft id,name

This command will give the ID and Name of the Timer job. Then, we may proceed delete command with timer job id.

$job = Get-SpTimerJob -id Your timer job id
$job.delete()

Timer job will be deleted from SharePoint farm.





Note: Restart the SPTimer service and IIS for safer side.

Thursday, March 12, 2015

Deleting Tags from Site in SharePoint 2013

Introduction

As all we know about tagging concept in SharePoint 2013. This is one of the main feature in SharePoint 2013 in content management. We can able to tag our interested content in SharePoint site. That tags will get populated in my profile. You can use Tag Cloud webpart to see those tags in team site. 

Tag Cloud webpart
 Click Here to get more knowledge about Tags. Let we see about how to delete those tags from site.

Deleting Tags

Do the following steps to delete the tag

  • Go to Central Administration
  • Click Manage Service Application in Application Management area 
  • Click Manage Meta Data Service
  • Expand System in Taxonomy Term Store at left panel
  • Expand the context menu in tags and Click Delete Hashtag
  • That's all tag will be deleted from the SharePoint sites. #slider tag is removed from tag cloud webpart





Monday, February 23, 2015

Edit Page is not working in Internet Explorer

Introduction

 Edit Page of SharePoint is not working with Internet Explorer. This is one of the known issue. To resolve this, do following steps

Goto Settings >> Compatibility  View Settings


Give the SharePoint Site URL there



Wednesday, December 3, 2014

Uninstall the WSP solution from SharePoint farm using Poweshell

Introduction

Normally, we are uninstall and remove the wsp from farm manually. Here i am sharing powershell script for this


$SPfarm = [Microsoft.SharePoint.Administration.SPFarm]::get_Local()



$solution = "SolutionName.wsp";
#Getting solution id
$currentSolution = $SPfarm.get_Solutions() | Where-Object { $_.DisplayName -eq $solution; }
$sol_file = $currentSolution.id

$spSolution = GET-SPSolution -Identity $sol_file
if ($spSolution.ContainsWebApplicationResource)
{
    $spSolution | UnInstall-SPSolution -AllWebApplications -Confirm:$false
}
else
{
    $spSolution | UnInstall-SPSolution -Confirm:$false
}

do { Start-Sleep -Seconds 1; Write-Host "Waiting for undeployment..." } while ($spSolution.DeploymentState -ne [Microsoft.SharePoint.Administration.SPSolutionDeploymentState]::NotDeployed)

Write-Host "Waiting for timer job to complete. " -ForegroundColor Yellow
Start-Sleep -Seconds 30

# Remove solution from solution store
Remove-SPSolution –Identity $sol_file -confirm: $false

Write-Host "Solution undeployed!" -ForegroundColor Green

Tuesday, December 2, 2014

Retrieve details of solution using powershell script

Introduction

Here i am going to share the script for show the details of solution which is deployed in the farm

$SPfarm = [Microsoft.SharePoint.Administration.SPFarm]::get_Local()

# What Solution are we looking for?
$solution = "Solutionname.wsp";

# Get the solutions
$currentSolution = $SPfarm.get_Solutions() | Where-Object { $_.DisplayName -eq $solution; }
$currentSolution;