Disabling mobile site within SharePoint 2010

As we all know that SharePoint creates a very basic (ugly looking) default site for mobile devices. When opening the site from any mobile browser, it automatically directs the website to the respective mobile website which has /m appended to it.
My client did not wanted the default mobile site to open within mobile devices as it gives a very untidy look so they wanted to disable the redirect function. If you have similar issues, follow the steps below to disable the redirection.
  • Navigate to:
    • C:\inetpub\wwwroot\wss\VirtualDirectories\<yoursharepointsite>\App_Browsers\compat.browser
  • Locate
    • <userAgent match=”iPhone”&gt
  • Now under tag, locate
    • <capability name=”isMobileDevice”    value=”true”/>
  • Change this to false
  • Now for Android, repeat the same thing and set the ismobileDevice attribute to false.

No need to reset the iis or anything else. Just save the file and browse the site from iphone, you will see the desktop site opening.

Also, I noticed that if you create a backup copy of the file with any name within the folder, the site breaks and doesn’t render. So make changes within the file and copy it to some other location for a backup copy.

There is a MobilityRedirect feature within the SPWeb which can be disabled to prevent the redirection as well.
  • Disable-SPFeature –Identity MobilityRedirect –Url

Hope this helps someone

Deleting work item in TFS using Visual Studio 2010

As I was setting up TFS (Team Foundation Services) for my upcoming SharePoint project, I created few work items such as Tasks, Sprint Backlog, Bugs etc. also created custom fields and values within them. To test these items, I created a few test work items before moving it to live. Now, I wanted to get rid of the test work items I created before I could log live data in it. So here comes this post, where I would write on how we can delete work items from TFS. So, first of all, there is no simple tick and delete UI from Microsoft which does so. Microsoft recommends using command line to delete the work items. There are some free tools available through few of the sites, but I prefer deleting using command line. Follow the steps below:
  • Open Visual Studio Command Prompt by navigating to Start > All Programs > Microsoft Visual Studio 2010 > Visual Studio Tools
  • Note down the IDs of the work items you want to remove from the TFS
  • Within the command prompt type the below syntax:
witadmin destroywi /collection /id:,,


Note: For noting down the IDs of the work items you can run a query that has ‘test’ in the Title field, provided you have entered test while your testing.

Resetting Sync databse within SharePoint

Resetting Sync database will delete the database completely with all the values in it.
I think one should reset the sync database as the last thing when all troubleshooting tricks provide no result. Only consider resetting when: 
  • Your import user profile connection is fetching details from AD but they cannot be seen on SharePoint
  • Similar scenario with export connections, so you want to push changes back to AD but you don’t see any changes on AD
  • You have modified settings on your FIM Client manually 

Here is a very nice article on resetting the sync database you should follow before considering a  reset:
PS: The User related information such as Profile Pictures, About Me etc. resides in Profile DB and the Social DB, these information will be safe as you do a reset of your Sync database

The tool was unable to install Application Server role. Web Server (IIS) role

While installing SharePoint 2013 onto Server 2012, I came across an error as “The tool was unable to install Application Server role. Web Server (IIS) role”. After browsing internet for resolution, I finally could resolve my issue. But while doing my investigation into the error, I came across posts where different people have tried different things to resolve the same error. I will try to collate those and post it in one single post.



Option 1 :
Go to Server Manager and click on Add Roles and Features
Select and expand Web Server (IIS) Role 
Select the IIS 6 Scripting tools under Management Tools within Web Server role
Click Nextuntil the wizard finishes
Rerun the Pre-requisite setup and see if you have been able to resolve the error.

Option 2: (only for Windows 2008 R2)
Go to command prompt and run this command:

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -i –enable

Option 3:
Run powershell with admin priviledges
Run the following commands: (I mounted my Server 2012 ISO on D drive)

Import-Module ServerManager
Add-WindowsFeature NET-WCF-HTTP-Activation45,NET-WCF-TCP-Activation45,NET-WCF-Pipe-Activation45

Add-WindowsFeature Net-Framework-Features,Web-Server,Web-WebServer,Web-Common-Http,Web-Static-Content,Web-Default-Doc,Web-Dir-Browsing,Web-Http-Errors,Web-App-Dev,Web-Asp-Net,Web-Net-Ext,Web-ISAPI-Ext,Web-ISAPI-Filter,Web-Health,Web-Http-Logging,Web-Log-Libraries,Web-Request-Monitor,Web-Http-Tracing,Web-Security,Web-Basic-Auth,Web-Windows-Auth,Web-Filtering,Web-Digest-Auth,Web-Performance,Web-Stat-Compression,Web-Dyn-Compression,Web-Mgmt-Tools,Web-Mgmt-Console,Web-Mgmt-Compat,Web-Metabase,Application-Server,AS-Web-Support,AS-TCP-Port-Sharing,AS-WAS-Support, AS-HTTP-Activation,AS-TCP-Activation,AS-Named-Pipes,AS-Net-Framework,WAS,WAS-Process-Model,WAS-NET-Environment,WAS-Config-APIs,Web-Lgcy-Scripting,Windows-Identity-Foundation,Server-Media-Foundation,Xps-Viewer -Source D:\Sources\sxs

Using Filters within InfoPath Data connection

I have been asked a number of times by various community members on how to fetch SharePoint list values within the Data connection based on certain condition, so I thought to write a post about it and spread the word.

InfoPath allows us to create data connections and fetch values from any SharePoint list. We can also select which column values we want to select. The data connection will then return all the items within the list, to control which value(s) we want to fetch, we can apply filters.

filters Click on the Dropdown properties and select/add a Data connection. In the Entries field, click the XPath selector button which will enable us to select which column value we want to bind to the dropdown control.


Select the parent node and click on Filter Data… to bring up the filter choices


Click on Add filter option and then you can select your InfoPath controls to create a condition for fetching the values from the list.


Click on Ok and run the form to verify. The list of values will be based on the conditions being set within the filter.

Using JQuery to hide SharePoint 2013 List Item fields

Hiding unnecessary fields in DispForm.aspx/EditFOrm.aspx is something most of us implement within our SharePoint implementations. Here is a quick way to achieve that using JQuery.
Hiding any List Item fields
So you have many fields in your NewForm.aspx but you want to hide some like in the screenshot. I want to hide the fields I haven’t underlined.

I will click on Edit Page, and add a Script  Editor webpart on the page. From the below script, just change the number in which your fields appear on the page using a 0 index. So to hide the first field, enter 0, second field – enter 1 and so on.


$(document).ready( function() {
$("TABLE.ms-formtable>TBODY>TR:eq(3)").css('display', 'none');
$("TABLE.ms-formtable>TBODY>TR:eq(7)").css('display', 'none');
$("TABLE.ms-formtable>TBODY>TR:eq()").css('display', 'none');
$("TABLE.ms-formtable>TBODY>TR:eq(9)").css('display', 'none');
$("TABLE.ms-formtable>TBODY>TR:eq(10)").css('display', 'none');
})

Also you can do some formatting on your page using Jquery, for example I am making the font as BOLD for the list item entries.

$(".ms-formbody").css("font-weight","bold");

Also,
I want to hide the information in the screenshot, you can add this line as well.

$(".ms-descriptiontext").css("display","none");

Hope this helps someone looking for a similar scenario.