Represents a field in a list on a SharePoint Foundation Web site.

learn more… | top users | synonyms

12
votes
3answers
17k views

How do I convert SPUser to SPFieldUser?

I have a field in a list that accepts an SPFieldUser object. I have an SPUser object that I would like to populate that field with, but I cannot implicitly convert from one to the other. How would I ...
12
votes
3answers
5k views

Is there a way to see if an SPField was created by a user?

I have some code where I am going through all of the Fields that belong to a content type. I'm curious if there is a way to check to see if the SPField was created by a user or if it is a system ...
10
votes
1answer
470 views

set column order of fields using CSOM/REST javascript

I am creting list fields using CSOM ecma script. How do I set the column order of the fields to be displayed in the form programmatically? For eg: I have created the following fields programmatically :...
8
votes
4answers
47k views

How to set ListItem Lookup Field value

How do I set a ListItem's Lookup field using code? SPFile file = list.RootFolder.Files.Add(destUrl, iStream, true); SPListItem item = file.Item; item["DocumentID"] = DocID.ToString(); item["...
8
votes
2answers
1k views

Localization on a SPField created in code

When you declare a SPField in CAML, you can add the localization in the code: <Field ID="{57258F13-19B2-4A97-B244-090845B5C4AB}" Type="Text" Name="Partner" DisplayName="$Resources:...
6
votes
2answers
6k views

UserMulti Field not allowing multiple inputs

I am trying to add a muliiple user site column using the following: <Field ID="{FC2612C2-1C60-45C1-949A-A49BECD8DB02}" Name="test" DisplayName="test" Group="test" Type="UserMulti" ...
5
votes
3answers
17k views

How to retrieve Users and Groups seperately from a “Person or Group” column via C# code?

I have a field in the discussion list, which allows the initiator of the discussion to specify the people to share the discussion with. This field is typed as 'Person or Group' that allows selection ...
4
votes
2answers
10k views

Programatically add SPFieldChoice (with Choices) to List

I have a list that I want to add a choice field to programatically. I also want to specify the choices. Here is the code: var fieldChoice = (SPFieldChoice)list.Fields.CreateNewField("Choice", "...
4
votes
3answers
8k views

SetFieldValue for a TaxonomyField

I'm on a solution where I create a term with some subterms in the termstore. After that I create a sitecolumn and a listcolumn. When setting a value to the listcolumns with taxField.SetFieldValue(...
4
votes
2answers
316 views

Get field values from SiteMapNode when getting Items from PortalSiteMapProvider

I'm trying to query my list using PortalSiteMapProvider. Here is my Code: public List<string> GetChachedItems(string webUrl, SPQuery query) { SiteMapNodeCollection nodeCollection = ...
4
votes
1answer
503 views

Field's TitleResource.SetValueForUICulture() does not work for the web's default language

I have a site column in my site collection whose title I change / translate with following PowerShell statement: $w = Get-SPWeb "URL to the site collection" $f = $w.Fields.GetFieldByInternalName("...
3
votes
7answers
7k views

ArgumentException when trying to access SPListItem value

I have a tool to update all items in SP (link replacement). The tool works most of the time but sometimes it throws me an ArgumentException ("Value does not fall within the expected range."). Here is ...
3
votes
4answers
1k views

Why does the ReadOnlyField hide the field in forms?

I have a field that I want to make not editable for the users. It's a field of type Text. I have read about doing it with javascript and content editor webbpart, but I want to do it programmatically ...
3
votes
1answer
796 views

Modified vs Last_x0020_Modified

Which is the difference between the fields: Modified and Last_x0020_Modified in a SharePoint list item ?
3
votes
2answers
128 views

How to seen all JSOM internal fieldnames not DisplayName of Column of the list?

I know to get the Internal Fieldname from URL. But that takes long time and status bar is not always full with the url, so you have to open ze field and see in the top url what the internalfield name ...
3
votes
3answers
584 views

The CHOICE element contains the value within its body. What gives?

As stated on MSDN, the CHOICE element contains the value within its body. That means that in a field, if I have: <CHOICES> <CHOICE>foo</CHOICE> <CHOICE>bar</...
3
votes
3answers
3k views

How can I get the status of a Workflow in C#

I need to get the status of a Workflow programatically. Things i tried: item[workflowName] - gave me a "8" altough the workflow is completed (seems to always return 8, I don't know why) (was not ...
3
votes
2answers
128 views

Calculated field based on a field in another list

I would like to create a calculated field which requires a digit. This digit must be between a Max and Min value which are two ListItems in another list. How can I create a formula for this calucated ...
3
votes
2answers
3k views

Using PowerShell how do I change the column ordering for a SharePoint List

Been trying to search for the answer to this, what I need to do is re-order the fields of a SharePoint list and propagate that change down to 300+ sites (should have used a content type, but oh well) ...
3
votes
1answer
1k views

How to update field name for a list?

I am creating custom lists(fields,CT,List Def and list Instance) A and B with visual studio. I have site column called "Status" i have used those column name in ListA and ListB. Suddenly i need to ...
3
votes
2answers
2k views

Using the ItemAdding EventReceiver to update multiple fields based on values from one field

I have a custom SharePoint 2010 SPfield of type SPFieldMultiColumn. The data in this column is stored in a delimited string, which is parsed and rendered in a readable format in most areas (list view, ...
3
votes
1answer
2k views

Updating a SPFieldMultiLineText field

I have an SPListItem. I have a field on the item of type SPFieldMultiLineText. How can update the value of that field?
3
votes
1answer
358 views

Placing CompositeFields for multiple list items on one form doesn't work as expected

In a workflow task, in custom edit form, i use CompositeField to render relevant fields current task item and for workflow item by setting a different context for CompositeField. However if i put ...
3
votes
2answers
852 views

Why do I get a security validation invalid error updating a field from a feature receiver?

Trying to change the title field of a document library to be required..doesn't want to work. SPList docLib = web.Lists["Process Aids"]; SPField field = docLib.Fields["Title"]; field.Title = "Display ...
3
votes
1answer
84 views

NewFormUrl stops user field from saving data

I have a custom content type inheriting from document set. The content type has various # of fields, including two user (e.g. Person or Group) fields. <Field ID="{2B2CA4F1-4F2C-40E9-A4B2-...
3
votes
1answer
375 views

Changing enterprise keywords column title programatically

I'm trying to rename an enterprise keywords column in a specific list of a subsite. In a Feature Activated event receiver i tried to set the column's display name by setting its title using the ...
3
votes
2answers
1k views

Create custom SPFieldLookUp that allows multiple values

I am pretty new to creating a custom field tupe and I have recently come across a need to create a custom SPLookUPField that allows multiple values. The main requirement is to change the way the ...
3
votes
1answer
2k views

SP2010 Relational Lists - User Objects show “#VALUE!” instead of value

I know I'm just doing something wrong here but after I create a SPFieldLookup object, attaching to content type, and then adding to list, all looks fine. I then add an item to the parent, which in ...
2
votes
2answers
326 views

Dates and times in Properties vs Fields

I'm trying to roll my own archiver for SharePoint. I always try to let the underlying object serialize itself. Only when it fails do I try to use .ToString(). Anyway, while inspecting the Properties ...
2
votes
2answers
2k views

SetCustomProperty within OnSaveChange

Saving Custom Field Type properties using SPField.SetCustomProperty within the IFieldEditor.OnSaveChange event does not seem to work, for reasons explained elsewhere. I've seen all kinds of bodges ...
2
votes
1answer
2k views

Create Hyperlink or Picture Column with C# (Format URL as Picture)

I am creating a SharePoint list with C# and have created a "Hyperlink or Picture" field like so: myList.Fields.add("Icon", SPFieldType.URL, true); when I add an item to the list in SharePoint this ...
2
votes
2answers
809 views

How to programmatically get questions from a Survey

The question is quite simple: how can I get the list of questions from a Survey?
2
votes
1answer
1k views

find out which page is not published in Pages list

I have a publishing site and about 20 pages in Pages list. When you check out one page the icon is changed and you detect that that page is checked out. However when there is a unpublished page it is ...
2
votes
1answer
1k views

SPField not visible on default view when SPList created programatically

I'm creating an SPList item programatically. Everything goes fine, I add a list, I add spfields to it. SPList list = (SPList)oWeb.Lists[listName]; SPField libraryNameField = new SPField(list.Fields,...
2
votes
1answer
283 views

why updating formula, title in large list/library programmatically takes really long time

I have to update formula of calculated field. I wrote method for that, it is working fine and is updating formula as well. But it takes really long time to update formula in large library ie library ...
2
votes
1answer
509 views

Get all lists and sites using a given site column in sharepoint 2007 using powershell

In other words, is there a SPField.ListsFieldUsedIn() equivalent in SharePoint 2007? Ref: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spfield.listsfieldusedin.aspx
2
votes
1answer
383 views

Have different column title in Edit View form and view itself

I'm using C# code to automatically create a read-only Note column that is a truncated version of an existing Note column. list.Fields.Add(field.Title + " (truncated)", SPFieldType.Note, false); At ...
2
votes
1answer
949 views

SPFieldMultiLineText.UnlimitedLengthInDocumentLibrary = true

We are running into problems with the 255 character limit on a multiline text field in a document library. I can change the setting to allow unlimited length, but the following warning is displayed: ...
2
votes
2answers
52 views

Required Field Color

How do you change the colour of either the field or the label of a required field when uploading/editing the properties of a document. The user says it is hard to see the little * ?
2
votes
1answer
31 views

What is PreviousID

I have a field in my list and not sure why it has PreviousID attribute. I have the same list in the same farm but in the different web application and does not have this attribute. <Field Type="...
2
votes
1answer
462 views

Setting the default value for a taxonomy field

I have been creating a load of site columns with powershell from a .csv file. I am now trying to create new taxonomy or metadata field: $spField = $web.Fields.CreateNewField($...
2
votes
1answer
281 views

executeQueryAsync fail on Chrome

I am using SP.ClientContext (JS library) to update some item's fields. It is working fine on IE but on Chrome I get this error (displayed as alert): Request Failed, status code 0 text '' The ...
2
votes
0answers
252 views

Custom field XSLT Rendering Issue in SP 2007, Works on 2010

I have created a VS 2008 WSP builder solution. IN that i have a custom field which has a XSL for list item view rendering using XSLT. This Solution does not render the image or hyperlink in SharePoint ...
2
votes
1answer
562 views

Copy list item field value to newly created custom column

I have the necessity to switch from using a default field to using a custom one in a number of list. I have also to "copy" the value contained in the old to-be-deleted column to the new created one. ...
1
vote
2answers
2k views

Updating 'Created By' field in SP2010 programatically

I'm trying to import data from an .xml file to a custom list in SP2010(created programmatically). I'm able to create and update all fields except 'Created By' as it says that "Cannot update read only ...
1
vote
2answers
2k views

Which field type can I use for more than 255 characters?

I try to create a new field programmatically. See code below. This type of field has a maximum of 255 characters. I would like to have more characters, like the page-content field. Which type do I ...
1
vote
2answers
344 views

What's A Field Group?

I need to create a field programatically, but the field has a required "Group" property. What is this property? What does it do/change? and what's a sensible value? MSDN as usual, failed to enlighten ...
1
vote
2answers
5k views

Try Get Field with client object model without error

Question regarding the client object model. I wrote some client script for a procedure, but i don't know, how can I determine if the list or item has the field available or not? For example: this....
1
vote
1answer
202 views

What are the largest and smallest values that can be stored in an SPFieldDateTime?

What it says on the tin, basically! I assumed it's the same as a regular .NET DateTime struct, but whenever I try to store 01-Jan-0001 (smallest DateTime value), I get an error. Can't find it on MSDN ...
1
vote
1answer
1k views

What type is Number field?

I have a Field, that has Type="Number". What type of variables can I assign to it? Will the field support float or double? oListItem["numberField"] = data; What type can data be? Cross posted from ...