Questions tagged [spfield]

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

Filter by
Sorted by
Tagged with
20
votes
4answers
71k 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["...
19
votes
3answers
5k 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 :...
17
votes
3answers
23k 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 ...
16
votes
5answers
7k 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 ...
11
votes
3answers
28k 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 ...
10
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:...
9
votes
2answers
9k 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" ...
7
votes
2answers
15k 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
1answer
3k views

Modified vs Last_x0020_Modified

Which is the difference between the fields: Modified and Last_x0020_Modified in a SharePoint list item ?
4
votes
1answer
4k 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 ...
4
votes
2answers
4k 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
1answer
4k 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?
4
votes
3answers
12k 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
450 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
2k 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
1answer
4k views

The object has been updated by another user since it was last fetched

I am trying to update a site column on my content. When I save the changes, I get the error "The object has been updated by another user since it was last fetched." When I searched the issue, I found ...
3
votes
4answers
3k 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
7answers
9k 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
2answers
230 views

How can I set the ShowAsPercentage property on SP.FieldNumber using REST API?

I am able to successfully create a new List column using the SharePoint REST API with the following JSON: {"Title":"My Title", "StaticName":"MyTitle", "Required":"false", "FieldTypeKind":9, "...
3
votes
3answers
711 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
5k 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
3k 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
1answer
149 views

How i can associate an SPFieldUser to a SPGroup

I am working on developing an event receiver inside my sharepoint 2013 farm on-premises. and inside the event receiver i am trying to assign a list column to a SPGroup. what i am trying to do is ...
3
votes
2answers
2k 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
2k 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?
3
votes
3answers
3k 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 Library ...
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
3k views

How to Get SharePoint field internal name using Display Name?

In SharePoint list I know the field display name. Using display name I want to get Internal name of field, string FieldName = "Test Field"; SPField field = olist.Fields.GetFieldByInternalName(...
3
votes
1answer
391 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
917 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
2answers
1k views

Get Value from Person or Group Type Field

How can I get Value from Person or Group Type Field from a List form. Context here is a SharePoint list. the point is I need to do this for validation purpose. So I need the value entered in this ...
3
votes
1answer
120 views

Cannot set list item value

I want to set a ListItem value with PowerShell (SP2013). As the following screenshot shows, I (the current user) have Full Control for this list. However, I cannot edit any field value. The value ...
3
votes
1answer
94 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
566 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 ...
3
votes
0answers
316 views

What is the purpose of “EntityPropertyName” property of field?

I am getting all list fields using REST API, In result, I found there is "EntityPropertyName" property for each field. For some fields, it shows exactly same value as "InternalName" property But for ...
3
votes
0answers
421 views

SPBuiltInFieldId in CSOM?

Is there any alternative to SPBuiltInFieldId in csom /SharePoint online? Should you only reference field only by InternalName in csom/SharePoint online?
3
votes
1answer
5k views

Uncaught TypeError: Cannot read property 'toString' of undefined

I have implemented the jQuery UI autocomplete functionality on a input field using JSLink. It works like a charm when I test it using Internet Explorer 9, 10, 11 and Chrome. Some users are however ...
3
votes
1answer
1k views

SPListItem.Update Not working

So I have this really simple function which updates a couple of fields on two different lists (one is a document library) The thing is on the document library does not updates any of the fields I need ...
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
2answers
582 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

Calculated default value in DropDown

I want to set the default value from a dropdown field based on the content type. So basically: If Contenttype equals "HW" than set dropdown default value to "1". Each time I try to set the following ...
2
votes
1answer
3k 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
610 views

Adding SPFieldLookup to specific content types in Custom List

I have a custom list that contains a number of custom content types. When a web is provisioned this custom list is provisioned. In addition to custom list is an Asset Library which is will serve ...
2
votes
1answer
25 views

SP07 - WorkFlow where update ListItem

I want to create a workflow where update list item and increase with 1 her value. This is for like, dislike functionality. Like field is type number: Where put a counter in workflow?
2
votes
2answers
4k views

Hide fields in new item menu

I have followed the answer described in Hide list column on new, edit item-OOTB But what I found is when editing the column from the content type, i found the hidden menu is disabled. Content type ...
2
votes
1answer
2k 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
339 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
547 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