Skip to main content

Posts

Showing posts from 2011

How to Customize SharePoint List Content Display using Content Query Web Part

Here I'm going to describe how we can use Content Query Web Part to Style SharePoint List. Thus Assume we are having a  SharePoint List Called Projects with Following Fields. As you already knew default look and feel would be like below. Now I'm going to render this list in to format something like below. Step One First you need to define Some names for these place holders ( Yeh., I know this do not make any sense to you. But don’t worry just do the step ). Thus I'm going to define these columns as follows. Title –> MyTitle Logo –> MyLogo Project Summary –> MySummary Project Description –> MyDesc Step Two Now you want to define a XSL Style Sheet using these names. Therefore I'm going to use <table> to layout the list item as below. < xsl:template name ="MyStyle" match ="Row[@Style='MyStyle']" mode ="itemstyle" >   < table border ='1' > < tr > < td

How to use SharePoint Feature to Activate and Deactivate Custom SharePoint Master page

Below example only set the Master page Url but not the custom master page URL. thus Layout pages will be same after you deploy the master page.  You can also change the Custom master page URL also. Feature Activation public override void FeatureActivated( SPFeatureReceiverProperties properties) { SPWeb web = properties.Feature.Parent as SPWeb ; string urlMaster; string urlCustom; if ( @"/" .Equals(web.ServerRelativeUrl)) { urlMaster = @"/_catalogs/masterpage/BLLICT.master" ; urlCustom = @"/_catalogs/masterpage/v4.master" ; } else { urlMaster = string .Concat(web.ServerRelativeUrl , @"/_catalogs/masterpage/BLLICT.master" ); urlCustom = string .Concat(web.ServerRelativeUrl , @"/_catalogs/masterpage/v4.master" ); } web.MasterUrl = urlMaster; web.CustomMasterUrl = urlCustom; web.Update(); } Feature Deactivation (Reverse to Original Master) public override void Feat

How to impersonate SharePoint Programmatically

There are many occurrences that we need to impersonate our SharePoint requests to server. Otherwise SharePoint will use system account or context credentials to perform the task. In my case i want to programmatically approve a workflow task. but then i noticed it is showing modifiedby as   system account so i used following code to change the user credentials to intended user. SPUserToken ApprovingUser = web.GetUserToken(“domain\username”); using ( SPSite site = new SPSite (“Site Url”, ApprovingUser)) { using ( SPWeb wb = site.OpenWeb()) { /* Do Anything You want */ } }

How to Use & Character in SharePoint List Instance’s Field value

There are some special characters which we can use in the XML. thus XML parser will return something like Entity X not defined like errors. this problem comes using ok special characters such as &, > and etc. Following shoes hoe you can use XML special characters inside the Field values in XML or SharePoint list instance creation. < Data > < Rows > < Row > < Field Name = " Value " ><![CDATA[ & ]]></ Field > </ Row > </ Rows > </ Data > you can use any special character inside the CDATA tag.

This document resides in a document library that is not trusted.

This error i got when I'm opening a SharePoint Task from MS Outlook . So it is pretty forward. You need to add the source site to the Trusted Sites in the IE (Internet Explorer) or ask network security admin to trust it from the proxy policies.

Security settings for this service require Windows Authentication but it is not enabled for the IIS application that hosts this service.

There can be many reasons for this. but before checking any of those web configuration things check the Authentication section in the virtual directory in IIS.  

How to do SharePoint 2010 Content Deployment

There are many articles in the web by describing Content Deployment in SharePoint 2010. But most of the time ( In my case it do not work fine always in first time :-( )  it is not working property and giving plenty of errors which direct us to restoring the backup rather than trying Content Deployment in the SharePoint Server. Here I'm going to my experiences and how I'm resolving those errors and little bit of background about the  SharePoint Content Deployment. Luckily i have manage to successfully proceed with the SharePoint Content Deployment most of the time. What is SharePoint Content Deployment   Content deploy can be use to export (deploy) content from one site collection to another site collection. content deployment is taking care of following contents in the source site collection. Web pages – Deploy corresponding images styles , master pages and etc. libraries lists resources Content Deployment do not deploy programs assemblies features config

Repair SharePoint Database

sometimes you may encountered with problems such as restoring failures and  content deployment failures thus it is better to repair the database and see where is there any orphan objects in the site collection. For that go to SharePoint Management Shell as an administrator , use following command stsadm -o databaserepair -url <url name> -databasename <database name> Example, here no Orphaned Objects found if they are listed run the command with deletecorruption option. stsadm -o databaserepair -url <url name> -databasename <database name> -deletecorruption

Power Shell Command for get SharePoint Feature (SP Feature) By ID

Use following power shell command to  search and get the SharePoint Feature. Get-SPFeature -Identity ID

SharePoint Solution deployment not working and Falling in the front end after installing the SP1 (SharePoint Service Pack 1)

This issue is also generate the following event log. Application Server Administration job failed for service instance Microsoft.Office.Server.Search.Administration.SearchServiceInstance Reason: Requested registry access is not allowed. Technical Support Details: System.Security.SecurityException: Requested registry access is not allowed.    at Microsoft.Office.Server.Search.Administration.SearchServiceInstance.Synchronize()    at Microsoft.Office.Server.Administration.ApplicationServerJob.ProvisionLocalSharedServiceInstances(Boolean isAdministrationServiceJob) these might be other reason also like not having correct permission to the application pool running user. But in my case i solved it by running the SharePoint Product Configuration Wizard .  

Presentation - MVC 3 @ University of Moratuwa

Mvc3 crash View more presentations from Melick Rajee @ University Of Moratuwa 20 Oct 2011 10.30AM – 11.30AM I have conducted this presentation  for IT students in Moratuwa University. The entire workshop is organized by Student Champs with great guidance of Wela . I hope presentation went well and few questions are asked from student also. The presentation gave an introduction and guidance to Microsoft MVC 3 application development.  

Generic Type Convert in C#

Cannot implicitly convert type 'object' to 'T'. An explicit conversion exists (are you missing a cast?)   Following code can be use to convert your object to generic value. T ret = (T) Convert .ChangeType( yourobject , typeof (T));

SharePoint 2010 List Template Ids

  ID List ID List 1200 Administrator tasks list 202 Meeting Attendees list 104 Announcements list 204 Meeting Decisions list 303 Blog Categories list 207 Meeting Objectives list 302 Blog Comments list 200 Meeting Series list 301 Blog Posts list 210 Meeting text box 105 Contacts list 211 Meeting Things To Bring list 120 Custom grid for a list 212 Meeting Workspace Pages list 118 Custom Workflow Process 117 No-Code Workflows 130 Data Connection library 2002 Personal document library 110 Data sources 109 Picture library 108 Discussion board 300 Portal Sites list 101 Document library 2003 Private document library 106 Events list 111 Site template gallery 150 Gantt Tasks list 102 Survey 100 Generic list / Custom List 107 Tasks list 1100 Issue tracking 112 User Information list 103 Links list 113 Web Part gallery 114 List template gallery 119 Wiki Page library 116 Master pages gallery 14

Form resubmit on Refresh

I had issue with resubmitting the form  when user refresh the form. i had to disable this accidental behavior in the MVC3. Yes of cause we can redirect to another action to prevent this behavior. but in my case i do not want to do that. there fore i used following JavaScript to disable browser refresh and back button . < script > window.history.forward(1); document.attachEvent( "onkeydown" , my_onkeydown_handler); function my_onkeydown_handler() { switch (event.keyCode) { case 116: // 'F5' event.returnValue = false ; event.keyCode = 0; window.status = "F5 disabled" ; break ; } } </ script >

InfoPath Repeating Rows Selection Issue/Problem

I had a problem with selecting InfoPath repeating rows for applying a condition. Therefore for i used following mechanism to correctly select the current row.  Here is my scenario, I’m writing a formula for fld_CorpStatus by accessing field fld_corpOff . but i should access the same row data in the run time. there for i used following xpath expression to access the fld_corpOff. current()/../fld_corpOff Explanation :- we are getting the current (fld_CorpStatus)  and then go to it’s parent (CorpOfficeGroup) the access the fld_corpOff

SharePoint 2010 CSS classes

Element CSS Class(es) Notes <body> v4master Applies CSS styles in corev4.css to the page. Ribbon container s4-pr Makes the Ribbon container the full width of the page row.   s4-ribbonrowhidetitle Used to show or hide the ribbon title area when the ribbon is opened or closed.   ms-cui-ribbon Defines the main ribbon CSS class.   ms-cui-ribbonTopBars Defines the elements above the ribbon body, from the top of the page up to and including the ribbon tab titles. Site Actions menu ms-siteactionsmenu Sets styles for the Site Actions menu as a whole.   ms-siteactionsmenuinner Sets styles for the inner Site Actions menu.   ms-menu-a Sets the margin-right property on the top menu. Breadcrumb menu s4-breadcrumb-menu Sets styles for the Breadcrumb menu as a whole.   s4-breadcrumb-anchor Sets styles on hover over the Breadcrumb menu. Breadcrumb menu header s4-breadcrumb-top Sets styles on the Breadcrumb menu top a

Please locate this file or insert Microsoft Visual Studio Team System 2010 Team Suite Beta 1 – ENU disk 1 now

this massage came when i tried to install  Visual Studio 2010 Service Pack 1. I do not have the Team foundation installed in my machine either. Ultimately i found that there is a program installed in Microsoft Team Foundation Server 2010 Beta 1 Object Model – ENU in the program files. i uninstalled it , Wow.. I manage to install the service pack without any errors.

How to Improve Workflow Performance in SharePoint Server 2010

SharePoint workflows are getting  slow for several reasons. in my environment I'm having a problem with following performance issues, therefore in my environment i got following problems. When a item added to the library it takes some times to initiate the workflow. Workflow mail generating is not very fast sometimes. Workflows takes more time to process “Due to heavy load, the latest workflow operation has been queued. It will attempt to resume at a later time” is coming sometimes. I had a custom workflow approval web part and it is taking more than 30 seconds to proceed. Work Done I had a custom workflow approval web part and it is taking more than 30 seconds to proceed. here in my custom web part there is the function which is programmatically updating the workflow. SPWorkflowTask.AlterTask(item, data, false) the last parameter mentioning whether it is synchronous asynchronous. if  is it true it it will wait until workflow schedule accept the workflow task. this

Introduction to InfoPath and SharePoint 2010 Integration

InfoPath controls View more presentations from Melick Baranasooriya

Load/Retrieve SharePoint List Items Using CAML in Client Object Model

  you can use following code segment to load data from SharePoint list using client object model. Microsoft.SharePoint.Client DLL should get from the 14/BIN folder. ClientContext clientContext = new ClientContext( siteUrl ); clientContext.Load(clientContext.Web); Microsoft.SharePoint.Client.List oList = clientContext.Web.Lists.GetByTitle( tasklistName ); clientContext.Load(oList); Microsoft.SharePoint.Client.CamlQuery cm = new CamlQuery(); cm.ViewXml = “<View>Some Query</View>” ; Microsoft.SharePoint.Client.ListItemCollection items = oList.GetItems(cm); clientContext.Load(items); clientContext.ExecuteQuery();

An entry has been added to the Windows event log of the server. Log ID:7893

This error cause to have an error occurred querying a data source in InfoPath when trying to query User profile service. This error is very strange because it is happening only some times . most of the time in the first time.   I found that following workout resolve the problem. in here i change the User profile service running application pool identity to someone who had access in the user profile service sharing. Following are the steps.. Then go to advanced settings and change the identity.   Make sure the account has accessed in user profile service sharing.

User profile synchronization service starting issues

There can be many problems which can cause to this issue, I will explain few which i found and how i address. user profile synchronization service stuck on starting here though i delete and recreate the user profile service application the synchronization still stuck in the middle. let briefly see how user profile working .. User Profile Service Application and User profile Synchronization share same Sync BD and Profile DB. But User profile synchronization service  access AD through Forefront Identity Manager Synchronization service. Workouts First Check Forefront Identity Manager is Working ( miisclient.exe ).  If this is starting most of the time their are no issues in Forefront Identity manager service and Sync Service. If so we have to check the databases for permission.  C:\Program Files\Microsoft Office Servers\14.0\Synchronization Service\UIShell\miisclient.exe If this not working (Most of the time this is the issue). we need to check following windows services. (Ser