Posts

Showing posts from June, 2011

Count this page Hits

Hi, Sometimes we require some webpart to calculate the number of hits on a particular page. I am sharing a Hit counter webpart which will count the number of hits on any page if added to any particular page. Following are the steps to create this Webpart: Step1: Create a SharePoint 2010 solution using default basic template. Step2: Add a Simple webpart named "Hit Counter" to the project. The webpart class will contains following code: using System; using System.ComponentModel; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using Microsoft.SharePoint; using Microsoft.SharePoint.WebControls; namespace HitCounterWebPart.HitCounterWebPart { [ToolboxItemAttribute(false)] public class HitCounterWebPart : WebPart { string cLoginName = string.Empty; string cDate = string.Empty; string cURL = string.Empty; SPList myList; private const string listName = "HitsList"; private const string fieldUrl = "Url&quo

Powershell: Creating and updating profile property

Hi Friends, I have recently create a user profile property using power shell commands. I am just sharing the code i used to create and then edit the properties like description, privacy settings, display settings etc of the property. Code to add/edit: if ((Get-PSSnapin -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null ) { Add-PsSnapin Microsoft.SharePoint.PowerShell } [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") [System.Reflection.Assembly]::LoadWithPartialName("microsoft.sharepoint.portal") [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Office.Server") [System.Reflection.Assembly]::LoadWithPartialName("System.Web") [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Taxonomy.dll") function CheckNull($obj, $name) { if ($obj -eq $null) { Write-Host $name "is null" -ForegroundColor Red return $true } return $false } $siteurl = "http:

Building Customer Service Applications

Image
Building Customer Service Applications The purpose of this sample code is to provide the reader with an insight into how SharePoint 2010 Service Applications can be used to create truly distributed scalable architecture. The sample code acts as a framework for developers who want to start creating SharePoint Service Applications without worrying about the underlying plumbing required to create such applications. The sample code demonstrates how service application can be used to create a service orientated application (SOA) within the realm of SharePoint 2010’s infrastructure. The sample provides a framework which can be used to create such applications without writing an extensive amount of boiler plate code. The example code provided, allows system administrators to capture auditing events from a particular site collection. The custom timer job is responsible for writing the audit events from the site collections to the provisioned database. A consumer (Web Part) is used to retrieve

Microsoft.SharePoint.ApplicationPages.dll

Hi, I was exploring some SP stuff related to the application pages, I need to refer applicatio pages dll and oops its not there in ISAPI. After exploring I wondered its located at: C:\Inetpub\wwwroot\wss\VirtualDirectories\<Your Virtual Server >\_app_bin\Microsoft.SharePoint.ApplicationPages.dll Here is the full list of assemblies at _app_bin folder: Microsoft.Office.DocumentManagement.Pages.dll Microsoft.Office.officialfileSoap.dll Microsoft.Office.Policy.Pages.dll Microsoft.Office.SlideLibrarySoap.dll Microsoft.Office.Workflow.Pages.dll Microsoft.Office.WorkflowSoap.dll Microsoft.SharePoint.ApplicationPages.dll STSSOAP.DLL Why SP is always so tough!!!! Haapy Sharepointing :)