SharePoint: In a CAML query, filter by lookup item ID, not by its value

by Vishal 2. December 2009 07:55

Yes its possible!

Your filter for the CAML query probably looks like this currently:

FieldRef Name ="Customer"/>
      <Value Type ="Text">
        Dunder Mifflin

But the "Customer" field is a lookup column to a different list of customers and on most view pages for customers, you probably need to fetch the related data using the Customer ID (the ID column for the customer list) and not the customer name.

Also, Sharepoint designer 2007 does not, using the UI, allow you to set a filter on a data form webpart and using a lookup column's ID field. You can only use the value of a lookup column in the filter.

Here's how I was able to do it after a bit of research...

FieldRef Name ="Customer" LookupId="true" />
Value Type ="Lookup">

Just add the LookupId = "true" attribute to the FieldRef tag and change the Value Type attribute to "Lookup". Your filter now looks up the value of the lookup column by using the ID of the item instead of the value.


Tags: , ,

CAML | CAML | CAML | CAML | MOSS | MOSS | MOSS | MOSS | Sharepoint | Sharepoint | Sharepoint | Sharepoint | XSLT | XSLT | XSLT | XSLT

SharePoint sites keep asking for authentication and credentials don't work on your dev machine

by Vishal 24. November 2009 07:54

So I set up a development VM, nice and clean on a fresh install of Windows Server 2003. I used the VM for a number of months to do development without problems. Then one day, I start it up and suddenly I'm being prompted for credentials each time I try to access a SharePoint site. Whats worse is that the credentials don't work and I keep getting re-promted. Eventually I get an access denied page. Another symptom wass I was unable to reset the App Pools for the web application and kept recieving an Access Denied error. The wierd part was the web applications were experiencing these symptoms when trying to browse them locally, but from a remote computer, they were working just fine.

Nothing changed on my machine so the obvious reason must be a windows update. Searching online, I found the following link which fixed the problem right away.

The issue occurs if you use loopback address mapping. Maybe you changed the hosts file on the local machine in order to set up a dummy domain for development. This used to work, but a recent windows update caused such a setu pto stop working and experience the above symptoms.

Field type <blah> is not installed properly. Go to the list settings page to delete this field. - When trying to use custom field types developed using VseWss 3.0 v1.3

by Vishal 14. November 2009 23:17

When developing a custom field type using VseWSS 3.0 v1.3, I encountered a strange problem. The field type compiled successfully and deployed successfully as well, but whenever I tried to use the custom field type, I just got a generic error in SharePoint: “Field type <blah> is not installed properly. Go to the list settings page to delete this field.” Looking into the event log, the SharePoint logs and the vsewss log didn’t come up with anything useful either.


After searching a while online and coming up with a bunch of different solutions documented by other people, I found nothing worked. I went back to reading the VseWss 3.0 v1.3 release notes a couple of times over; especially the following couple of lines under the “Known Issues” section:

  • Custom Field Controls
    • During packaging additional XML configuration code will be added to the fldtypes_FieldControlName.xml file. To ensure the correct deployment of your field control you must add (if not already present) and Guid attribute to your SPField derived class. 

public class MyFC1Field : SPFieldText 

  • After packaging your project you must modify the fldtytypes_FieldControlName.xml file and synchronize the following element with your class's Guid:

<Field Name="FieldTypeClass">f5627588-e216-402e-844f-f85a0db34aa5</Field> 

·         Field control items are not able to be deployed due to a GUID being inserted instead of the type in the XML. This is a known issue , you can manually add the correct entry which will result in two entries in the fldTypes*.xml file 

I wasn’t entirely sure what this meant by when comparing the fldtypes_blah.xml that gets generated for the field type at C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\XML and the fldtypes_blah.xml in my vsewss project, there was a difference.

The vsewss fldtypes_blah.xml contained:

<?xml version="1.0" encoding="utf-8"?>

  <Field Name="TypeName">LogFieldFieldControlField</Field>    
  <Field Name="TypeDisplayName">LogFieldFieldControlField</Field>
<Field Name="TypeShortDescription">LogFieldFieldControlField</Field>   
  <Field Name="ParentType">Text</Field>
<Field Name="UserCreatable">TRUE</Field>
<Field Name="FieldTypeClass">b2931c02-1f9c-4eeb-8839-421be14a38d5</Field>

The generated fldtypes_blah.xml that gets put in the 12 hive contained:

<?xml version="1.0" encoding="utf-8"?>
 <Field Name="TypeName"BlahFieldControlField</Field>   
 <Field Name="TypeDisplayName">BlahFieldControlField</Field>   
 <Field Name="TypeShortDescription">BlahFieldControlField</Field>   
 <Field Name="ParentType">Text</Field>   
 <Field Name="UserCreatable">TRUE</Field>   
 <Field Name="FieldTypeClass">blah.blahcontrolfield</Field> 

Looks like the FieldTypeClass field node that contained the guid of the field type class gets replaced by the class name on deployment. But the class name is not fully qualified like most manual steps state that it should be.

I replaced it in the deployed fldtypes_blah.xml so that the xml node now looked like:

<Field Name="FieldTypeClass">Blah.BlahFieldControlField, blah, Version=, Culture=neutral, PublicKeyToken=8adae1dce348f885</Field> 

i.e. the value is namespace.classname, assembly name, version, culture, publickeytoken  

Then restart IIS

that got my custom field type working. So what you need to do is deploy the solution using vsewss 3.0 v1.3, then go into C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\XML, find your fldtypes_blah.xml and replace the FieldTypeClass node text which contains the class name to contain the fully qualified class name. Then restart IIS. So far this is what has worked for me, but if I come up with a better way, I’ll update this post.

Tags: , , , , , , ,


SharePoint versus file shares. When to use SharePoint and when to use a traditional file share?

by Vishal 19. September 2009 06:04

I get asked this question a lot. If an enterprise adopts SharePoint internally, does SharePoint replace file shares? 

My short answer is, no - SharePoint and file shares are not the same thing and they not meant to be thought about or used in the same way.  

Firstly SharePoint has limitations on the content that it is able to effectively store based on its type, its size, its numbers and its use. You can use a file share to store anything at all, provided there is available disk space. A fileshare has different limitations on how many documents it can effectively store and how it retrieves and searches them. 

Secondly, there is a reason why you are choosing to use SharePoint to store a particular document over a file share. It may be that

  • it is a file that needs to be made easily available (published) to multiple people within an organization,
  • or that it may actually needed to be worked on by different people,
  • or that different versions of it need to be maintained as it evolves,
  • or that there is a need to store additional business meta data around the document that cannot be stored in a traditional file system,
  • or it needs to be effectively and easily searched for by business users
  • or that it requires certain business processes to be built around it such as approvals or alerts. 

If you have none of the needs above, maybe you’re better off using a traditional file share.

For example, your IT department probably does not want to store the Windows 7 installer in a SharePoint document library. Your marketing department probably does not want to store its 700 mb video files that do not require versioning, collaboration, have any content to search within SharePoint. All that content can remain in a file share. 

SharePoint is a great place for storing files that are used for collaboration or publishing among team or across organization. It is even especially beneficial when you have given a good amount of thought to what files you are storing in document libraries and thought about the document metadata, its purpose and the business processes that the files are part of. This truly allows you to use the power of SharePoint to share, collaborate, search and publish documents and build business processes (workflows, events etc.) around these activities easily and quickly. This is the real reason why you want your files in SharePoint. 

On the other hand when you think of a file share, in the traditional sense, you are often talking about unclassified documents, with no business metadata, no versioning in the classic sense and you are talking about storing any type of file. The file could be a 10 GB video file, a PowerPoint presentation, a executable file or anything else. Little thought is given to what it is that you are actually storing, there is no related business metadata and usually difficult to build business processes around the contents. 

You do not want to replace your file share by dumping a huge number of unclassified files that were in a file share, into a share point document library. There is little benefit to doing this. There will be no business metadata that you will need to tie to unclassified content or build business process around. It would also be a pain point for users to effectively be able to use and search.

By doing your thinking ahead of time, you will quickly realize which of your unclassified documents that were in a file share need to be moved to SharePoint document libraries. You also realize that there will be different document library locations for different files. A document library would only hold carefully selected files having something in common and some business meta data in common, probably sharing a content type and business processes. 

Hopefully this will help you decide between when (and most importantly, how) to use SharePoint and when to use traditional file shares, for storing your files. A completely different conversation and should also be thought about, is the use of SharePoint versus document management systems like documentum or document locator. I never believe that there is a universal solution. A good solution depends on the problem it solves. There is always a very good reason to use SharePoint, file shares or a document management system depending on what business problem you are looking to solve. The only thing is, do your thinking & planning ahead of time – understand the problem or problems before deciding on the solution. 

Tags: ,

MOSS | Sharepoint

Getting Ready to split up a very large MOSS 2007 Content DB into multiple content DBs

by Vishal 16. July 2009 03:01

 Very Exciting. Getting ready to split up a large content DB on a large enterprise level moss farm deployment. The idea is to distribute data that has grown over time into multiple content databases for performance and reliability. The plan is to use stsadm -o mergecontentdbs. However this is known to have implications and issues - We are taking all necessary steps to avoid any problems. I'll update this post later on how our operation does.

 Update - Sorry for the late update guys. heres how it went.

 We had 2 tasks ahead of us. One was to move a content db from one database server to another in the cluster. The other was to split up a large content db on one of the servers into multiple content dbs.

Splitting the large content db into multiple content DB's:

 Microsoft recommended that we do not run the merge content db command on databases larger that 10 GB in size. So instead of moving out the larger site collections into new content databses, we decided to move all of the smaller site collections out instead. This would take much longer, but would be safer so we went that route.

  1. Make sure we stop all search crawls. This is important. Not pause but completely stop the search crawls. Let the running crawls complete and remove the schedule for all future crawls. If we do not do this, we take the risk of corrupting our search indexes.
  2. Create the new content databses
  3. Run stsadm -o preparetomove on the content db to be split
  4. Create a sites.xml using stsadm -o enumsitecollections on the source content database
  5. split up the sites.xml into manageable chunks containing the site colllections that we which to split out
  6. run stsadm -o mergecontent dbs on the source and destination content databases using the site.xml files created in step 5 to move the site collections from source to destination database to the destination content databases
  7. run stsadm -o databaserepair command on the source and destination databses to remove any orphan records - we had none
  8. test

we moved approximately 150 GB of data from a large content database into 5 diffenet new content databases. It took us approximately 18 hours including testing. After the maintennance, we improved page response times for the site collections. We also reduced app pool recycles for our web applications due to processes hitting their virtual memory limits. These almost seemed to dissapear after the maintennance. Overall we were very happy with the results.

Moving a content db from one server to another:

We had multiple large content databases on one server and we wanted to balance it out by moving a large content database from one server to another in the cluster.

  1. Run stsadm -o preparetomove on the content db to move
  2. detach the content db by running stsadm -o deletecontentdb
  3. using sql management studio, detach the content database from the server instance
  4. move the databse files from the source server to the destination server
  5. using management studio, re-attach the content database on the new sql server
  6. add the content database by ising stsadm -o addcontentdb
  7. Test

that was pretty much it. After our maintennance, we started our search crawls and reset the schedule. balancing out the databases also increased performance on our web applications.

Tags: ,

MOSS | Sharepoint

Windows Vista Service Pack 2 (SP2) installation increases disk space

by Vishal 2. June 2009 20:25

So, here's a nice little effect of installing Windows Vista SP2... it increases free disk space!

I just did installed it today and my free disk space increased by 11 GB! 11 GB...! What did SP2 delete??

And I'm not the only one. Almost Everyoneone who has installed SP2 is seeing an increase in free space on their system from 5GB to even upto 130 GB.

We'll see what microsoft says about this but for now it was a nice surprise knowing vista to be such a disk space hog.

update: So was looking arround some more and one of the reasons for increased free space is that SP2 seems to clear the shadow volume copy cache which wasn't limited in vista earlier, and limits it. This led to big increases in free disk space.

see - better explanation.

Tags: , ,

General | Windows | Vista

ssms tools pack - Auto Generate CRUD stored Procedures for your database and more

by Vishal 1. June 2009 19:53

Just found a great tool that will hopefuly save me tons of work...

It can auto-generate the CRUD stored Procedures for your tables - that was the most useful to me. Plus there are a lot of other useful features for the IDE.

  • Window Connection Coloring.
  • Query Execution History (Soft Source Control) and Current Window History.
  • Search Table or Database Data.
  • Uppercase/Lowercase keywords and proper case Database Object Names.
  • Run one script on multiple databases.
  • Copy execution plan bitmaps to clipboard.
  • Search Results in Grid Mode and Execution Plans.
  • Generate Insert statements for a single table, the whole database or current resultsets in grids.
  • Text document Regions and Debug sections.
  • Running custom scripts from Object explorer's Context menu.
  • CRUD (Create, Read, Update, Delete) stored procedure generation.
  • New query template.

Sharepoint Dev Wiki

by Vishal 25. May 2009 22:47

I think this was long needed. A must have link for sharepoint admins and developers. Also great for business wanting to gain more insight and understanding into customization and development on sharepoint. I usually get a lot of different views when it comes to specific topics on sharepoint development. I think a wiki is a great idea to get all of those views in one place and create open discussion.

 check it out!


Tags: ,

MOSS | Sharepoint

Adding Color Columns to Sharepoint lists

by Vishal 2. November 2008 21:02

I was working on a project that used a sharepoint list with a column called "Urgency" that was a choice column with values "Low", "Medium", "High". The client wanted to show the co0lumn in the list view but instead of the text, show a corresponding color - Green for Low, Orange for medium and Red for High. Also I needed to have this configured without downtime or custom code.

I found a great post online here that helped me do exactly that using a calculated column and a content editor webpart, out of the box!


  • Create a column in the list called "Urgency Level" for example. Its a choice column with values "(1) Low", "(2) Medium", "(3) High"
  • Create s column in the list called "Urgency" which will display the color. This is a calculated column. The formula for this column is

          =”<DIV style=’font-weight:bold; font-size:24px; color:”&CHOOSE(RIGHT(LEFT(Urgency Level,2),1),”red”,”orange”,”green”)&”;’>&bull;</DIV>”

  • Add a content editor web part to the bottom of the page and copy the below script into it.

<script type="text/javascript">
var theTDs = document.getElementsByTagName("TD");
var i=0;
var TDContent = " ";
while (i < theTDs.length)
TDContent = theTDs[i].innerText || theTDs[i].textContent;
if ((TDContent.indexOf("<DIV") == 0) && (TDContent.indexOf("</DIV>") >= 0)) {
theTDs[i].innerHTML = TDContent;
// ExpGroupRenderData overwrites the default SharePoint function
// This part is needed for collapsed groupings
function ExpGroupRenderData(htmlToRender, groupName, isLoaded)
var tbody=document.getElementById("tbod"+groupName+"_");
var wrapDiv=document.createElement("DIV");
wrapDiv.innerHTML="<TABLE><TBODY id=\"tbod"+ groupName+"_\" isLoaded=\""+isLoaded+ "\">"+htmlToRender+"</TBODY></TABLE>";
var theTBODYTDs = wrapDiv.getElementsByTagName("TD");
var j=0;
var TDContent = " ";
while (j < theTBODYTDs.length)
TDContent = theTBODYTDs[j].innerText || theTBODYTDs[j].textContent;
if ((TDContent.indexOf("<DIV") == 0) && (TDContent.indexOf("</DIV>") >= 0)) {
theTBODYTDs[j].innerHTML = TDContent;

Thats it! Here was the result:


 Also, you would have realised that you can do a lot more than add just colors, you can add any html to be rendered including scripts, mouse overs, colors, images...

Tags: , ,

e-commerce | MOSS | Sharepoint

Tool to build WSP solutions for MOSS/Sharepoint Projects

by Vishal 10. September 2008 18:46

The tool is called STSDEV. I found it on codeplex. The tool allows you to generate Visual Studio Projects & Solutions to facilitate building of MOSS deployement solutions. Its a simple command line utility that allows you to select the kind of deployment you are trying to do. The hoices include, empty solutions, features, webparts etc. By simply selecting the type of solution and clicking a button, it creates the visual studio project templates for building the WSP. You can drag and drop all of your deployment files into a predefined 12 hive structure. Hitting build on your solution, atomatically create sthe manifest file and builds the wsp. Till now I was building the mannifests and wsps by hand and that is a pain.

There are a number of build configurations generated for you that allow you to retract, deploy, redeploy, install the solutions directly to MOSS without needing to use stsadm. Its a great little tool for development and debugging.

 The project can be found at

 Here are some sceen casts that are very helpful in getting you started:



Tags: , ,

.NET | Sharepoint | MOSS

L symphonique de la derniere chanson, jh cherche professeur de danse, est tres belle et la partition se maintient au meme niv imitation replique rolex montres montre pendant toute la chanson, rehaussee par le son des violons. Un technicien et d ax pompes fnebes Bonio ces gandes tentes tiisees po assombi es maisons et signifie e dei. Mes dip seont es ps ties en es int ma magie po c de noveax replica uhren tos. replique montre diesele oU i fat veie a ce qe chaqe escapin soit mis en vae dans e moinde detai. "Je n'ai pas d'avis medical sur ta situation, mais par contre il est clair que tu en souffres, donc rien replique montres que pour a ton medecin devrait t'ecouter. Et "la" rando : les gorges de Samarie (mais attention, hyper frequente en ete). Le groupe etait assez heterogene, de la quinqua qui le faisait pour son plaisir aux etudiants bac +1 divers mais avec une majorite de terminales (toutes rolex replique sections confondues) donc je ne pense vraiment pas qu'il y ait eu de selection. D'autant qu'il y a deux nivcopie de montre rolex de difficulte et que certains chapitres ne seront accessibles qu'en ayant un minimum d'allies dans replique montre notre equipe, a la fin du copie de montre de luxe. Le fis d gitaiste des Pink Foyd fait appe de sa peine de pisonAge de 21 ans, e jene homme, etdiant en histoie a Cambidge, avait ete aete a son domicie apes a manifestation conte a rolex montre pas cher hasse des fais nivesitaies e 9 decembe a Londes, maqee pa des incidents.
Repliques Montres haute qualite vous aider a economiser beaucoup tout en appreciant la valeur du nom de marque. Vous voulez avoir cette montre luxe haut de gamme suisses sur votre main, mais replica uhren l'achat d'une voiture semble une meilleure option. Oui, c'est la realite. Ces montres symbole de statut social co?tent quelque chose replicas de relojes qui est au-dela pour permettre pour une personne normale. Mais ne desesperez hublot replique montres pas si vous ne pouvez pas vous permettre d'acheter ces montres de luxe. Vous avez une belle occasion d'acheter des montres de prestige nom Replique de la marque. Certaines personnes aiment l'aspect d'un veritable montres au poignet, ou replique rolex montres voulez juste nombreuses montres de marque pour correspondre a leur habillement, mais evitez patek philippe replica orologi de depenser des milliers de dollars que une vraie montre mai cots, ils se tournent vers les replique montre montres bonne replique. Si vous ne voulez pas acheter des montres de veritables montres de haute qualite puis de replicas sont votre choix ideal.