Wednesday, February 25, 2015

Create a Custom Master Page for SharePoint 2013 for Teams/Publishing Site Collection



I have successfully created a custom masterpage for SharePoint 2013 using Visual Studio 2013. Here are the steps I did to create my custom masterpage:Open the 15 hive to directory "15\TEMPLATE\GLOBAL"
  1. Copy the "seattle.master" file (or the oslo.master file)
  2. Create a new directory on your C: and paste the file
  3. Rename the file to anything you want. (i.e. seatle_k.master)
  4. Open Visual Studio 2013
  5. Create a new empty project
  6. Add a new module (2 files are created inside the module automatically.)
  7. Change the name of the module (i.e. ModuleMP)
  8. Delete the sample.txt file that was created automatically by adding the module
  9. Add an existing file to the module. Browse to your new seatle_k.master file and add it.
  10. Open the elements.xml file in the module.
  11. Change the <Module ...> by adding "List=116" and Url="_catalogs/masterpage"
  12. Change the <File ...> by adding Type="GhostableInLibrary"

    <?xml version="1.0" encoding="UTF-8"?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <Module Url="_catalogs/masterpage" List="116" Name="ModuleMP">
    <File Url="ModuleMP/seattle_kcpl.master" Type="GhostableInLibrary" Path="ModuleMP\seattle_k.master"/>
    </Module>
    </Elements>

  13. Change the name of "Feature1" to something more useful (i.e. K_Feature1)
  14. Double click on Feature1 (now K_Feature1) and add custom text to the title and description.
  15. Double check that the project will deploy to the correct site collection URL by checking the "Site URL"
  16. Build your project
  17. Deploy your project
  18. Assuming everything went well your project should be successfully deployed.
    (In my case it errored out with "unable to activate feature". then I created the package wsp and deployed with powershell, Add-SPSolution then manually deployed it from Central Admin.)

    If this is a publishing site collection, you can change the new masterpage from Site Settings -->Master page and Page layout under look and feel. If this is Team Site Collection then pls follow the below steps.
  19. Open the destination site collection and go to the site settings. Check site features and double check that the solution was added and automatically activated.
  20. Open SharePoint Designer 2013
  21. Open the destination site where you deployed your new acme.master file
  22. In the left-hand vertical navigation in SPD click on the link "Master Pages"
  23. You should see your new acme.master file in the list
  24. Right-click on the acme.master file and click link "Set as Default Master Page"
  25. Ignore and click 'OK' when a pop-up message telling you that there is no associated html file to your masterpage.
  26. Navigate to your destination site in Internet Explorer to see your new masterpage


Monday, February 16, 2015

Find PID for IIS Application Pool’s Worker Process


This blog post will show the different methods to identify the process ID (PID) for an active worker process (w3wp.exe) for an application pool
Method 1: - Internet Manager UI
  • Open IIS Manager
  • In the Connections pane, select the server node in the tree
  • In Features View, double-click Worker Processes
  • View the list of worker processes in the grid
Method 2: - Appcmd
Appcmd is used to list out the running worker processes. The path to the utility is not set and running directly from the command prompt will fail. Use the following instructions to set the path for the utility.
Location of appcmd.exe %systemroot%\system32\inetsrv
64-bit Windows, use Appcmd.exe from the %windir%\system32\inetsrv directory, not the %windir%\syswow64\inetsrv directory.
Set the path to the location
  • Start -> Computer -> Right Click ->Properties
  • Advanced System Settings -> Environment Variables
  • System Variables -> Path -> Edit
  • Add C:\Windows\System32\inetsrv
To start Appcmd.exe
  • Click Start, and then click All Programs.
  • Click Accessories, and then click Command Prompt.
  • At the Command Prompt, > cd %windir%\system32\inetsrv, and then press ENTER if the path is not set. Otherwise, enter appcmd on the command line
To List the started worker processes
>appcmd list wps
clip_image001
For complete listing of appcmds Listing of IIS 7+ Appcmd
Method 3: - Task Manager
  • Start Task Manager
  • Select the Processes tab
  • Add the following columns from View->Select Columns
    • PID
    • Command Line
  • Sort the Image column and find the w3wp.exe process name
  • Expand the Command Line column and the worker process name is on the far right
Method 4: - Process Explorer
  • Find the svchost.exe in the Process column and the w3wp.exe processes are listed
  • Expand the Command Line column and the worker process is listed
clip_image002

Thursday, January 22, 2015

Powershell Commands



New ULS Logs file
Use the below command when ever you want to create a new new Log file.
This is very helpful while investigating an issue. To get ULS logs for 30 seconds, execute the below command twice at starting and end of 30th second, so you will have a separate log file for the time period.
New-SPLogFile


Merge URLs Logs:
Combines trace log entries from all farm computers into a single log file on the local computer.

Merge-SPLogFile -Path <String> [-Area <String[]>] [-AssignmentCollection <SPAssignmentCollection>] [-Category <String[]>] [-ContextFilter <String[]>] [-Correlation <Guid[]>] [-EndTime <DateTime>] [-EventID <String[]>] [-ExcludeNestedCorrelation <SwitchParameter>] [-Level <String>] [-Message <String[]>] [-Overwrite <SwitchParameter>] [-Process <String[]>] [-StartTime <DateTime>] [-ThreadID <UInt32[]>]

Tuesday, November 11, 2014

SharePoint Event Receivers that are running on a List

It is tough to find out running "Event Receivers" for a SharePoint list.
Here is a way using Power Shell script to know the Event Receivers bound to a List:

$web = Get-SPWeb -Identity "http://pc.gn.com/sites/CO"
$list = $web.Lists["Order List"]
$list.EventReceivers


Add-PsSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
$spWeb = Get-SPWeb -Identity "http://pc.gn.com/sites/CO"
$spList = $spWeb.Lists["Order List"]
$evts = $spList.EventReceivers
$evts
Write-Host("..." + $evts.Count)
if ($evts.Count -gt 0) {
            foreach ($evt in $evts) {
                Write-Host("..." + $spList.RootFolder.ServerRelativeUrl + ", " + $evt.Type)
            }
        }


TO delete an event receiver from a List:
Once you confirm  the event receivers, use below to delete them
Add-PsSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
$spWeb = Get-SPWeb -Identity "your site url"
$spList = $spWeb.Lists["TrackTravel"]
$evts = $spList.EventReceivers | where {$_.Assembly -eq ""your assembly"}
$evts
if ($evts.Count -gt 0) {
            foreach ($evt in $evts) {
                Write-Host("Deleting..." + $spList.RootFolder.ServerRelativeUrl + ", " + $evt.Type)
                $evt.Delete()
            }
        }

And the other way is:
To know the Event Receivers bound to a List and Events that ran on a List Item (Title: MI4803)
USE WSS_Content_XXX
SELECT * FROM EventReceivers WITH (NOLOCK)
where Class like 'GN.SP2010%'

select * from dbo.EventLog
where ListId = '1648253C-ED8F-44AE-B2EB-A19238102B41'
and ItemName = 'MI4803'

Thursday, April 24, 2014

Reports with SharePoint List as data source

[Draft}

One easy way to generate dynamic reports/metrics based on SharePoint List as data source is using SharePoint Designer and various List Views.

Other easiest way is using SSRS services on SharePoint and Report Builder 3.0 as report development tool.

To create reports using Report Builder 3.0 go through the link:

1. Install SQL Server Reporting Services with SharePoint Integration Mode and attach to the SharePoint Form. or install SSRS with SharePoint Integration Mode on any of the existing SharePoint Server.

2. Enable Reporting Services on SharePoint Form in Central Administration and make sure it is running and you can see SSRS related section on Central Administration.

3. Enable the below highlighted features and PerfornamcePoint Services to use PerformancePoint Dashboards/ScoreCards/KPI etc.




4. Create a document library and enable Content Types and add Reporting services related content types as described in this link.

Create A SharePoint Document Library To Store SSRS Reports



Reports in SharePoint - draft


You have various ways to create reports on SharePoint based on the various data sources like SharePoint List/Library as data source or external data sources like SQL Server/Oracle DB.

If the Oracle DB as your data source the only way to create reports and use in SharePoint is use some external reporting tools like Cognos/SAP BO/ etc and integrate them with SharePoint with the help of integration components.

If the data source is a SQL Server, you can use SSRS which has easy integration with SharePoint.

If the data source is SharePoint Lists/Library, you can use SSRS and Report Builder 3.0 as report development tool.

Document Library VS Record Library


 A Records Library is a document library but with a Records Management slant. It is available in the Records Center site by default but won`t be available in any of the other site templates.

Record library is a document library configured to "allow multiple content type", "Document check out before editing", "Versioning" etc.. including "Automatically declare items as records when they are added to this list".  So when a document is uploaded to a Record library it is declared as a record and there by deletion can be prevented. There is a new feature in SharePoint 2010 called In Place Records Management. This allows certain SharePoint documents (or blogs, wikis, web pages, and list items) to be declared records. The system can prevent such records from being deleted or edited.  For more details ...

Document Library Planning