Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I'm building a project consisting of two features; the first one contains, among other things, the following field definition:

<Field ID="{E9821752-3293-4c3f-B377-22ABB7AF2F04}" Name="TruckNo" DisplayName="Truck No" Type="PartIdentifier" Group="Part Request" />

and the second one, the definition

<Field ID="{7A876984-EE88-445a-95A2-0D9B32082EBC}" Name="TruckNo" DisplayName="Truck No" Type="Text" Group="Part Order" />

When I build and deploy both features, it turns out that – surprise – only the first field definition appears in the Sharepoint column list. If I change the internal field name for the second definition to something like "OrderTruckNo", though, both columns appear in Sharepoint. It looks like there's a name clash between them.

What's the purpose of the GUID, then, if each field must have a unique name anyway? And how can I make sure that my features can even be deployed on any given Sharepoint machine, as there's always the possibility that it has some columns with the same names as mine? What am I missing?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

You are correct - InternalName and GUID must both be unique. If you don't specify an InternalName, the DisplayName will be used to generate one, and as this is the same for each, you're getting a collision.

As to why the GUID as well - good question, much like why list items have both a GUID and an ID that is unique in a list. Still, it's worth noting that you can access a field in an SPFieldCollection by GUID, InternalName or index number - all of which must be unique (and, naturally, in an array the index number is unique!)

Finally, how can you always make sure that your features can deploy given the risk of name collision - good question. As far as I'm aware, you cannot ensure this.

share|improve this answer
    
Not quite the answer I was hoping for, but thanks a lot anyway. –  Mihai Feb 16 '11 at 8:27
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.