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

learn more… | top users | synonyms

10
votes
2answers
12k 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 ...
9
votes
3answers
3k 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 ...
8
votes
2answers
878 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" ...
6
votes
4answers
27k 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(); ...
4
votes
2answers
3k 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" ...
4
votes
3answers
8k 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
2k 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) ...
4
votes
2answers
152 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 = ...
3
votes
7answers
5k 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
3answers
420 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> ...
3
votes
3answers
917 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
1answer
311 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
1answer
51 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 ...
3
votes
1answer
214 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
963 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
1k 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
5k 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", ...
2
votes
1answer
154 views

Modified vs Last_x0020_Modified

Which is the difference between the fields: Modified and Last_x0020_Modified in a SharePoint list item ?
2
votes
2answers
216 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
5k 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 ...
2
votes
2answers
1k 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
2answers
113 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
359 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
2answers
1k 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, ...
2
votes
1answer
1k 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?
2
votes
2answers
699 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 ...
2
votes
1answer
690 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 ...
2
votes
1answer
524 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 ...
2
votes
1answer
231 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
429 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
339 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
736 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
1answer
80 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
169 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 ...
1
vote
2answers
750 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
181 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
1answer
111 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
849 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 ...
1
vote
3answers
1k views

Multilanguage fields in programatically created list

If I'm creating a custom list in my code, how can I make fields localized, so when user has set e.g. Polish, he can see field names in polish and when he has English language set, he can see field ...
1
vote
1answer
1k views

How to make field text bold in custom edit form?

I am already using custom field iterators to customize the fields on my list forms. When users are creating or editing a list item, I want certain field names to show in bold. For example, when users ...
1
vote
2answers
141 views

New field is not accessible via Powershell

I have a list "Orders" in SP, where I have some data. The list definition and instance were previously created in Visual Studio and then successfully deployed. Today I've opened VS again and added ...
1
vote
2answers
732 views

Field level permission development

I am aware that there already are some questions regarding on how to implement field level permissions customization in SharePoint, such as: SP 2010: column permission Permissions for List or ...
1
vote
2answers
3k 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: ...
1
vote
1answer
36 views

Field name already exists

All I have backed up a sharepoint site and restored to another environment. I have a specific list which I want to update the default value of a hidden field in powershell I found the field, set ...
1
vote
1answer
73 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 ...
1
vote
1answer
766 views

How to set the default value to sharepoint date time field programmatically?

I want to set the default value for the sharepoint's built-in field ArticleStartDate programmatically. But I am unable to do so. My code is as follows: SPField articleDate = ...
1
vote
2answers
58 views

Disappear background in HTML Field

I created HTML field in SharePoint 2010 <Field ID="{3E83492C-0420-473E-AB65-E4355535AFD0}" Name="MyField" StaticName="MyField" DisplayName="My Field" Type="HTML" Required="FALSE" RichText="TRUE" ...
1
vote
2answers
162 views

ItemAdding in document library

I have an issue with setting the field in item updating event in document library with SharePoint 2007. I have following situation, I have a document library, and when i add a document based on one ...
1
vote
1answer
167 views

difference between item[] and item.fields[]

I want to retrieve let's say the title field of my item so what's the différence between doing these acces methods : SPList myList = properties.List; string mytitle1 = ...
1
vote
1answer
671 views

Modifying XSL for multi lookup field

I'm trying to create custom XSLT for a multi lookup field, based on this article. When changing disable-output-escaping to yes I can see the html I want to modyify: <a ...