Tag Info

Hot answers tagged

7

AvailableContentTypes is readonly, so you need to use ContentTypes instead. $field = $web.Fields[$fieldName] $ct = $web.ContentTypes[$contentTypeName] $link = new-object Microsoft.SharePoint.SPFieldLink $field $ct.FieldLinks.Add($link) $ct.Update($true)


3

Hello Michal: There is nothing out of the box that would offer that functionality. Indexes are unique on a per column-basis and each column index is independent. The ItemUpdating event receiver is the best place to do this. You could simply have the event receiver query the list to see if a duplicate record exists before the item is created or saved.


3

I had changed a field definition's property and found that the new definition was synced to the subscribing site after also republishing a content type that was using the customized site column. I did this on SharePoint 2010, and only had one content type that was using the customized site column. In this case I had changed a Date/Time field's default value ...


3

Interesting - I used this very scenario (upgrading a field from text to note) in a demo recently in a conference talk, to show off SharePoint 2010's new upgradable Features framework. In both SP2007 and SP2010, changing the type of fields which are in use is unsuppported, as you've discovered. My recommendation would be: Take a backup in case rolling ...


3

According to the Docs, the best answer to me is that the AllowDuplicateValues attribute is used when defining the field in XML code while the other is used when writing .Net code.


3

Is it correct you didn't install VS2010 SP1? After installation of SP1 I don't think it will happen again. When you're not able to install it now, you can restart Visual Studio and try to deploy the solution again.


2

Have you tried this for other fields than Title? The spec for SPField.EnforceUniqueValues states that You cannot set this property to true for a built-in field or for a site column. Not 100% that this is valid for the declarative approachs for custom schemas, but test with another field "test" of type text and you will find out...


2

Could you add your field manifest? Also, what does the feature receiver do? Are you using sp2010or sp2007? I havent tried with choice fields, but setting DisplaceOnUpgrade="true" instead of owerwrite="true" for field declaration helps upgrading existing fields.


2

You can use UnlimitedLengthInDocumentLibrary="TRUE" attribute to enable more than 255 characters on a note field. But if you want more than 255 characters on your note field with rich text capabilities - why don't you just use an HTML field?


2

I have only seen this problem when fields were created as Number field, like <Field Type="Number" DisplayName="DemoNumber" Required="FALSE" Group=" Demo Field" ID="{1221b2d2-992d-4abf-a80a-55585c234c55}" SourceID="{e834bd2e-72bf-4aab-9ef4-4f3e118526e2}" StaticName="DemoNumber" Name="DemoNumber" Decimals="0" Percentage="FALSE"/> Did you by any chance ...


2

Somewhere in your feature you have invalid GUID....check that and make it correct. Use VS create GUID option.


2

Your .cs, .ascx, .xml and .xsl files are only invoked when rendering the field, and each time the field is shown on forms & list views. The contents of the elements file will reference something in the Schema file, so the schema file is loaded first before the contents of the elements, and this is done only on Feature activation. For the rest, the ...


1

Provided the column is bound against the list you're using then it's always available in code regardlesss of the ShowInNewForm/ShowInEditForm settings. Double check that the item you're working with is of the correct content type and that your list actually does have the right columns bound in the first instance.


1

It is recommended to reference the field by it Internal Name or ID In your code there is no any guarantee that you are really modifying title for Enterprise Keyword field, because Display Name is used for reference So, below is updated code to change Enterprise Keyword field title: //Rename title for Enterprise Keyword field in List public ...


1

I found these script, but it don't need the folder query... but there are some things in (e.g. the Caml-Query and the move function) that i need, but i dont know how i can customize These script for my idea. Donwloadlink


1

Did not get your code clearly, what is fieldId and how are you getting this fieldId? my guess is location is already there in the content type you can not add the same field again, create a new field if you wish, in that case your code will be (after foreach) - string fldName = fields.Add(fieldToAdd.Title, fieldToAdd.Type, fieldToAdd.Required); SPField ...


1

You can debug the custom field by using the Attach to Process, and attach to your w3wp process for your site. Alternatively, you can use CKS extensions in Visual Studio, which will attach you automatically. HTH


1

Daniel is right in so far as the docs say to use AllowDuplicateValues in CAML schema and EnforceUniqueValues in code. The documentation is wrong, though; to make the CAML work you need to use the EnforceUniqueValues attribute.


1

First question: Yes they can Second: yes see: image


1

There are various ways to do this. It depends on your needs. Do you want to re use the contenttypes and or site columns, then its maybe best to put them in a seperate xml. - Create site columns in a seperate xml - Create a contentype in a seperate xml - Create list definition and reference the contenttype However if you don't want to reuse the site ...


1

You can put more then 255 chars in it using code. However using the SharePoint UI this should not be possible.


1

This has been answered on this forum previously. Check out this link: How to adjust the title column in custom content type in SharePoint 2010? It was the top result on Google when I was trying to find you some relevant reference material. Also check out this link: ...


1

I have not tested this but try <Field Name ="aatColleague">-1;#Mathieu.Landry</Field>


1

Here's how to do it programatically: // Assuming list contains a SPList object string fieldID = "FieldUniqueID"; list.Fields.Add(fieldID, SPFieldType.Text, false); list.Fields[fieldID].Title = "$Resources:Example,FieldUniqueID"; list.Fields[fieldID].Update(); Note that you cannot stick "$Resources:Example,FieldNameI18N" right into Fields.Add() because ...


1

The problem is that when you create a column, the name you enter is just a constant string. SharePoint does not do translation based on known words. Internationalization is based on resource files. And while I have used resource strings with custom list definitions, I wasn't sure if they would work on lists and columns created in the browser. So tried a ...


1

How I would approach this is the following: Create a custom field type http://msdn.microsoft.com/en-us/library/bb862248.aspx. This includes an xml definition and a class inheriting from SPField. Your field type would handling storing some sort of representation of the column as a string (Maybe ListName;ColumnName) and then resolving that representation to ...


1

Maybe instead of using the ItemAdded event, you could try using the ItemAdding event? Example What you also could do is create a workflow on the listitem that activates when the item changed. First check if the "Issue ID" is not empty. If so, than send an email to a group. To let users subscribe to an "alert", I would create a webcontrol where users are ...


1

I just ran across the same situation. I had imported some lists from SharePoint into VS2010 and saw StaticName in the definition. I never used it before. I deployed my custom lists without StaticName (and they always worked correctly), and then imported my list into VS2010, and StaticName was set. It appears SP takes care of it for you.


1

What you need to do to ensure that the fields you don't want to see are not exported, is create a view that shows only those fields that you want to see and export that view. As far as the "Path" that field is exported by default, and you will have to manually delete it from the excel spreadsheet.


1

Regardless of your encoding problem, updating the xml that was used to create fields will not push down the changes to existing fields based on that xml. If you want to update the DisplayName for existing fields, you would have to write some code (in a FeatureReceiver) to do this for you.



Only top voted, non community-wiki answers of a minimum length are eligible