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

learn more… | top users | synonyms

8
votes
2answers
9k 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 ...
8
votes
2answers
709 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" ...
7
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 ...
5
votes
4answers
18k 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
62 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
6answers
4k 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
345 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
1answer
2k 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" ...
3
votes
3answers
77 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
149 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

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

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 ...
3
votes
2answers
793 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 ...
2
votes
2answers
3k 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
2answers
101 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
4k 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
900 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
618 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
488 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
329 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
204 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
370 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
306 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
584 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
274 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 ...
2
votes
0answers
92 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
236 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
117 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
84 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
677 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
906 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
997 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
1answer
294 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
1answer
86 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 ...
1
vote
2answers
38 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
361 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
119 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
2answers
4k 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 ...
1
vote
1answer
134 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
493 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 ...
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
283 views

Update field by code behind

I have an existing list with a text field and records in it. Now I want to change that text field into a calculated field to make it concat two other text fields in the list (possibly by changing the ...
1
vote
1answer
917 views

How do I get values of fields from custom lists?

I have a custom list ("Contacts") as well as a web part with forms. I want to take the custom list fields and map them to the web part form. My problem is getting the values from the custom list. I've ...
1
vote
2answers
2k views

How to have a column contain multiple users

I have a list with various columns. One of those columns is to store users. However, when I use the code configurationListFields.Add("Limit_Access_To", SPFieldType.User); I am only allowed to ...
1
vote
1answer
56 views

How to get username through REST

I am currently working with a task where you have a SPList in one farm that holds some data that we need to aggregate into a view on another farm. Therefore I am working on a Visual Web Part that ...
1
vote
0answers
43 views

Determining wether SPContentType and SPField are created by user or not

I am doing a migration tool (web part) that copies a site collection from point a to point b. Everything works so far, but currently only custom lists are copied to point b. Now I need a way to ...
1
vote
0answers
75 views

JavaScript function in URL field value

Is it possible to set the value for the URL field so that when clicked it runs a JavaScript function? I have created a field which stores links to files in SharePoint, but when clicked, the file is ...
1
vote
0answers
35 views

Is it actually possible to instantiate SPField?

I want to create a custom List programmatically from scratch: First I add: Guid listID = web.Lists.Add(title, description, SPListTemplateType.GenericList); list = web.Lists[listID]; Then I want to ...