Posts

URL fields in SharePoint Content Query Web Part

Image
When a content query web part is used to query and display the items in the Links list, i got the output in a very undesirable format. As you can see in the image above, it is showing the URL of the link followed by a comma and then the link text. Also when you click on the link in will take you to the display form for that item in the links list instead of taking us directly to the URL of the link. So i started to modify the XSL to get the desired bahaviour which is It should show only the link text without the URL The hyperlink should point to the URL rather that the display form for that item. For this go to your site's Style Lirrary->XSL Style Sheets Download a copy of the ItemStyle.xsl I named the copy as CategoryItemStyle.xsl. Modify the content of it to this Upload the CategoryItemStyle.xsl to the Style library-> XSL Style Sheets. Then export the default the Content Query Web Part and open in it in notepad or Visual Studio Change the ItemXslLink ...

Remove hyperlink for lookup columns in SharePoint

Image
I tried to look for how to remove the hyperlink for the lookup columns in SharePoint. I was expecting some kind of an XSL transformation. But all the posts i found in the internet were using JavaScript for this functionality.  So i decided to work on the XSLT myself. I know this is a much cleaner and efficient solution. And this is how it is done. I have a list with a lookup column called "DeptLookup". To remove the hyperlink follow the below mentioned steps Open this list in SharePoint designer. Click on the AllItems.aspx to open it. Select the lookup column Click on the formula on the ribbon This will open a dialog for you called Insert formula The default formula for the lookup column is $thisNode/@*[name()=current()/@Name] Change it to substring-before(substring-after($thisNode/@*[name()=current()/@Name],'>'),'<') Click on OK and save the changes. Now when you go to the list, you will see the lookup values without the hype...

SharePoint Edit Page and Personalize page using Javascript

I had to dig deep to find out what are the javascript functions called when we click the Edit Page button the SharePoint ribbon. I had to hide the ribbon for one of my client's requirements and i had to provide links for Edit Page, Personalize page and Save page. I have used three hyperlinks for each of these functionalities. This is how we can do it in SharePoint. <a href="javascript:ChangeLayoutMode(false);">Edit</a> <a href="javascript:ChangeLayoutMode(true);">Personalize</a> <a href="javascript:ChangeLayoutMode(null,true);">Save</a> These functions are available in a Javascript file which SharePoint includes by default. So you just have to place this html on your page and there you go.

Config file for SharePoint custom timer jobs

Image
SharePoint timer jobs run under the OWSTIMER.exe process. This process has a configuration file associated with it. We can use this config file to specify the configuration settings that are to be used in custom timer jobs. Open the OWSTIMER.EXE.CONFIG and add the <appSettings> tag to it. Then add your key value pairs under this appSettings tag For this you have to add a reference to System.Configuration Then you can use the  System.Configuration. ConfigurationManager .AppSettings[ key ]  to retrieve the values for a key from the config file. Example:  string dept = System.Configuration. ConfigurationManager .AppSettings[ "Department" ];

Create User Profiles using SharePoint Object Model

In this post i will show you how you can use the SharePoint object model to create User Profiles programmatically. For the code to work make sure you have a User Profile Service application created and associated to your web application. You have to add references to two assemblies which will be available in the 14 hive/ISAPI Microsoft.Office.Server Microsoft.Office.Server.UserProfiles You have to get the ServiceContext first and then get the UserProfileManager from the service context. The UserProfileManager provides ways to add and edit profile to your SharePoint. string  socialDataStatsSite = "http://servename:port/" ; using ( SPSite siteColl = new SPSite (socialDataStatsSite)) { SPServiceContext serviceContext = SPServiceContext .GetContext(siteColl); UserProfileManager userProfileManager = new UserProfileManager (serviceContext); UserProfile profile = null ; bool existingUser = userProfileManager.UserExists(AccountName); if (existingUser) { profile = userPr...

Windows 7/Windows Server 2008 R2 SP1 released

Microsoft has released the Service Pack -1 for Windows 7 and Windows Server 2008 R2. The main feature in Windows Server 2008 R2 SP1 being the addition of RemoteFX. RemoteFX is a feature which enables rich user experience for Remote Desktop users. It enables rich interfaces with the utilization of GPU on the host. This means that remote desktop users can have a full blown Windows desktop experience remotely even from a thin client just as complex as a LCD display.The GPU on the server is shared among all the clients with the RemoteFX technology called VGPU(Virtual Graphical Processing Unit). The remote users can have all the rich experience of Sliverlight or 3D graphics from the client utilizing the VGPU. With the huge adoption of cloud by multiple organizations, Microsoft has yet again made a break through with RemoteFX by enabling the remote users to have rich User Experience which is the foremost requirement for an end user. With this great leap i expect more virtualization and mor...

Handle Session Start for SharePoint 2010 applications

Image
I ran into a situation where i have to handle the session start of a SharePoint application. I dint find much information about it in the internet, so i decided to post one myself. There are two main steps for this. 1. Enable sessions for your SharePoint application 2. Handle the Session_Start event. To enable Sessions for SharePoint application, make the following changes in your web.config 1. Make enableSessionState= true 2. Replace the <httpModules/> with the below       <httpModules >            <add name="Session" type="System.Web.SessionState.SessionStateModule" />       </httpModules > 3. Add the Session module for your SharePoint site from the IIS Manager.     Open IIS Manager and expand sites.     Select your site and double click on Modules. Click on Add Managed Module on the right hand side Actions menu Give a name to the module and s...