Pages

Monday 1 September 2014

ULS Viewing Like a Boss (ULS Viewer is now available)


About the Unified Logging Service

The Unified Logging Service (ULS) is the primary logging mechanism in SharePoint to make it easier to develop applications, expose in-depth information for debugging, and vehicle to isolate problems or threshold issues when they are encountered.  ULS writes events to the Trace Log and stores them in the file system.
For Developers ULS logs act as an extension of existing development tools as another debugging facility, in some scenarios, mitigating the need to attach a debugger to isolate an event.
For IT Professionals and support personnel ULS logs provide enough information and metadata to help determine the course of action necessary in resolution of an event and expedite support escalations where required.
The ULS Viewer provides a solution the enables presentation of ULS Log entries in a human readable format to aid in troubleshooting.

New ULS Viewer Features

Monitor multiple servers simultaneously, because we know you need to troubleshoot more than just a standalone server…


Personalize the output with the option to edit formatting.


Support for locating a specific log line within one or more ULS Logs based on a command line argument which enables other tools and solutions can leverage ULS Viewer as an external log viewer.
Example:
ulsviewer.exe –fileat:@
Time format is yyyy/MM/ddTHH:mm:ss.FF
Support for opening multiple ULS Log files in a single tab based on a command line argument which enables other tools and solutions can leverage ULS Viewer as an external log viewer.
Example:
ulsviewer ... -combine
Optionally you can combine with "-fileat":
Example:
ulsviewer -fileat:@

Fixed in ULS Viewer

Resolved updating defined filters while in paused state which provides IT Professionals and Developers an additional tool to isolate issues in high trace flow environments.
Fixed Find Again command missing matching entries.
Fixed issues with multi-line messages.
Applies more strict filter with RegEx when finding the uls log files in the log folder so that non-uls log files are not picked.


Download

To download the ULS Viewer visit http://www.microsoft.com/en-us/download/details.aspx?id=44020.



Source of this post:
http://blogs.technet.com/b/wbaer/archive/2014/08/22/uls-viewing-like-a-boss-uls-viewer-is-now-available.aspx





Tuesday 3 June 2014

Using SPSiteDataQuery with Content Types


I was working on a solution to find items by its content type throughout site collection using SPSiteDataQuery. I would suggest using Content Type ID  instead querying using content type name as I found it breaks when move to other UAT or Production environments.



Thursday 8 May 2014

Minimal Download Strategy In SharePoint 2013

Minimal Download Strategy (MDS) is a new technology in SharePoint 2013 that reduces the amount of data that the browser has to download when users navigate from one page to another in a SharePoint site. When users browse an MDS-enabled site, the client processes only the differences (or delta) between the current page and the requested page. Figure 1 shows the sections that change from page to page and therefore require an update. The delta usually includes the data in the (1) content areas, as well as other components such as (2) navigation controls.





























You can identify a site that has MDS enabled by looking at the URL. An MDS-enabled site has the (3) _layouts/15/start.aspx page in the URL followed by a hash mark (#) and the relative URL of the requested resource, as shown in Figure 1. For example, the following is the MDS-formatted URL for the page newpage.aspx:
https://sp_site/_layouts/15/start.aspx#/SitePages/newpage.aspx
It is equivalent to the following non–MDS-formatted URL:
https://sp_site/SitePages/newpage.aspx

 Enabling and Disabling MDS:

            MDS is actually a SharePoint Feature which is Scoped to Web, whose Id is “87294C72-F260-42f3-A41B-981A2FFCE37A”. The Feature is very straight forward. It toggles the “EnableMinimalDownload” property of the SPWeb object. It can be toggled by Server Side or CSOM or Power Shell. But the MDS is not enabled or compatible with Publishing Site. 
 
Eg: (In JavaScript)
  1. var clientContext;  
  2. clientContext = new SP.ClientContext.get_current();  
  3.   
  4. this.oWebsite = clientContext.get_web();  
  5. this.oWebsite.set_enableMinimalDownload(true);  
  6. this.oWebsite.update();  
  7.   
  8. clientContext.load(this.oWebsite);  
  9.   
  10. clientContext.executeQueryAsync(  
  11.     Function.createDelegate(this, successHandler),  
  12.     Function.createDelegate(this, errorHandler)  
  13. );  
  14.   
  15. function successHandler() {  
  16.     alert("MDS is enabled.");  
  17. }  
  18.   
  19. function errorHandler() {  
  20.     alert("Error: " + arguments[1].get_message());  
  21. }  
 Every request is sent with the Header “X-SharePoint”. This header contains the information about the Master Page, Language and whether the page is read-only or read-write. 
 
 The PageRenderMode Control: 
  1. <SharePoint:PageRenderMode runat="server" RenderModeType="MinimalDownload" />  
 The RenderModeType property takes either “MinimalDownload” or “Standard” as the values. When the Publishing Feature is enabled, page will be having the ribbon. Specifically when using Publishingribbon in master page, SharePoint will automatically inject the control with the RenderModeType property set to Standard.

 MdsCompliant: 
               If the site is upgraded from 2012, by default the upgraded sites will not be rendered by MDS even if “EnableMinimalDownload” property is set to true. This is because  Delta Page checks all the controls in the page for a particular attribute called “MdsCompliant”. If any of the controls present on the page which does not have this attribute or IsCompliant property set to false , will not render any delta for that page. We can also add MdsCompliant to the assembly instead of adding it to each  class.
 Eg:  
  1. [MdsCompliant(true)]  
  2. public class Example: WebPart  
  3. {  
  4.     protected override void CreateChildControls()  
  5.     {  
  6.         this.Controls.Add(new LiteralControl("MDS is enabled:" +   
  7.             SPContext.Current.Web.EnableMinimalDownload));  
  8.     }  
  9. }  
 
The basic mechanics of MDS are pretty simple. The main components of MDS are two engines, one in the server and another in the client, that work together to calculate the changes and render the pages in the browser when the user navigates from page to page in the site. Figure 2 shows the MDS flow when a user navigates through an MDS-enabled site.
Figure 2. MDS flow when a user navigates the site

MDS flow when a user navigates the site
  1. The browser requests the changes between the current page and a new one in the SharePoint site.
  2. The MDS engine in the server calculates the delta between the current and the new pages.
  3. The MDS engine in the server sends the delta to the MDS engine in the client.
  4. The MDS engine in the client replaces the changed areas on the current page with the new page content.
The resulting page is exactly as it would have been if the page had been downloaded without MDS.
The MDS engine in the client includes a download manager. All requests in the page are routed through the download manager. All controls in the page must subscribe to the download manager to learn when a URL has changed. The download manager makes one request for all the new control data. To be able to work with search engines, the MDS engine doesn’t directly use the href attribute of anchor tags to store MDS-formatted URLs. Instead, the SPUpdatePage function handles the onclick event and uses it to communicate with the server. The SPUpdatePage function is declared in the _layouts/15/start.js file.
The URL plays an important role in MDS. An MDS URL looks like the following: https://sp_site/_layouts/15/start.aspx#/SitePages/newpage.aspx.Start.aspx contains minimal shared UI and instructions for loading page changes. MDS considers the part following the hash mark (#) as the target page. The target page starts with a slash (/) followed by a URL relative to the SharePoint website. When the browser receives the URL, it sees that the part to the left of the hash mark hasn’t changed, so it fires a local navigation event. The MDS engine in the client captures the local navigation event and uses it to perform an MDS update.

MDS FailOver: 
In some situations it’s not possible to determine whether the page can be updated properly. In these situations, the MDS engine issues a failover, which consists of an extra round trip to redirect the browser to the full version of the new page. These are the most common reasons why failover occurs:
  • The new page has a different master page.
  • The current master page has changed.
  • The MDS engine detects non-compliant HTML, for example:
    • Pages using ASP.NET 2.0
    • CSS or scripts not registered in the MDS engine
    • Illegal HTML
  • There are non-compliant controls on the page, for example:
    • The control is not in the MDS engine whitelist.
    • The control assembly is not marked as compliant.
    • The control class doesn’t have the MDS attribute.
The MDS engine tries to recover from a failover after the user navigates to yet another new page.
 Benefits:
Using MDS provides several benefits, including:
·         Speed
·         Smooth transitions
·         Browser navigation controls
·         Backward compatibility



Refrences : http://msdn.microsoft.com/en-us/library/office/dn456544.aspx

Monday 28 April 2014

Debug Diagnostic Tool

Debug Diagnostic Tool

The Debug Diagnostic Tool (DebugDiag) is designed to assist in troubleshooting issues such as hangs, slow performance, memory leaks or memory fragmentation, and crashes in any user-mode process. The tool includes additional debugging scripts focused on Internet Information Services (IIS) applications, web data access components, COM+ and COM+ related Microsoft technologies, SharePoint, and .NET framework.

It is composed of the following 3 components: a debugging service, a debugger host, and the user interface.

The Debugging Service The debugger service (DbgSvc.exe) performs the following tasks:

  • Attach/Detach the host to processes
  • Collect performance monitor data
  • Implement HTTP ping to detect hangs
  • Inject leak monitor into running processes
  • Collect debugging session state information
  • Shows the state of each rule defined
    The Debugger Host The Debugger Host (DbgHost.exe) hosts the Windows Symbolic Debugger Engine (dbgeng.dll) to attach to processes and generate memory dumps. It also hosts the main analyzer module to analyze memory dumps. Dbghost.exe has no dependency on the service “DbgSvc.exe” and can be used separately. The User Interface The user interfaces (DebugDiag.exe and DebugDiagAnalysisOnly.exe) present an interface to analyze memory dumps, automate the creation of control scripts and to show the status of running processes, including services. It is composed of 3 views: 

    • Rules: Creates control script for the debugger host through a wizard. The script is located under the directory \scripts.
    • Advanced Analysis: Runs a selected “Analysis Script” against one or more memory dumps.
    • Processes: Shows status of running processes/services.

Features of Debug Diagnostic Tool

Analysis:

.Net 2.0 and higher analysis integrated to the Crash Hang analysis.
SharePoint Analysis Script.
Performance Analysis Script.
.NET memory analysis script (beta).
Native heap analysis for all supported operating systems

Collection:

Generate series of Userdumps.
Performance Rule.
IIS ETW hang detection.
.NET CLR 4.0 support.
Managed Breakpoint Support.
Report Userdump generation to the Event log.

Deployment

Import/Export of rules and configuration, including ‘Direct Push’ to remote servers.
Enterprise deployment support using XCopy and Register.bat.
Download the tool from the below links
http://www.microsoft.com/en-us/download/details.aspx?id=26798



Refrences : http://www.microsoft.com/en-us/download/details.aspx?id=26798
                    http://adicodes.com/performance-tool-debug-diagnostic-tool/#more-1147

Friday 25 April 2014

Get Query string values using JavaScript


You don't need jQuery for that purpose. You can use just some pure JavaScript:

function getParameterByName(name) {
    name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
    var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
        results = regex.exec(location.search);
    return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}

Usage:

var Location = getParameterByName('location');   // Location = india



Thursday 20 March 2014

SharePoint 2013 Platform Options

What BDMs and architects need to know about Office 365, Windows Azure, and on-premises deployments


    For BDMs and architects, this model describes the platform options for SharePoint 2013—SharePoint in Office 365, on-premises hybrid with Office 365, Windows Azure, and on-premises only deployments. It includes an overview of each architecture, recommendations, license requirements, and lists of architect and IT Pro tasks for each platform. Several SharePoint solutions on Windows Azure are highlighted.
Source: http://www.microsoft.com/en-in/download/details.aspx?id=40332

Thursday 6 March 2014

Update User Profile using PowerShell


So, requirment goes here...

I was suppose to do change in user profile , for some employees who left the company.
so if you have a huge list of userprofile to update and doing it manually is a tedious task to do.
Just automate it..  :) 

Script refers a csv file, which contains domain and user details 
Snapshot:



 

 

 

Here is the script to update user profile


cls
Add-PSSnapIn "Microsoft.SharePoint.Powershell"

$mySiteUrl = "http://mysite.test.env.local"
$findProperty = "myproperty"  #property name here
$termName = "termname"  #term name here
$mySiteHostSite = Get-SPSite $mySiteUrl
$mySiteHostWeb = $mySiteHostSite.OpenWeb()
$context = Get-SPServiceContext $mySiteHostSite

# Obtain Profiles from the Profile Manager
$upm = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager ($context)

$create = Import-Csv -path C:\PowershellScript\UpdateBAGF.csv
ForEach($row in $create) {
    $userProfile = $upm.GetUserProfile($row.Domain + '\' + $row.LoginName)
    $t = $userProfile[$findProperty]
    $t.clear()
    $t.add($termName)
    $userProfile.Commit()
}