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