Questions tagged [spfield]
26 questions
7
votes
4 answers
Programmatically setting field value for sharepoint listitem
I'm trying to simply add a simple text or hyperlink field to a list item in sharepoint 2007.
I can add the field no problem:
list.Fields.Add("MyField",SPFieldType.Text, false);
And it shows up fine on my list items.
However no matter which way I…

Dynde
- 2,592
- 4
- 33
- 56
3
votes
2 answers
Can I create my own formula for calculated field in Sharepoint 2010 using C#
I want to create a programmatically calculated field for Sharepoint 2010 using Visual Studio 2010 in C# language.
Is there a way to set a formula that will call to my own function and return a result back to the field?
My scenario:
let's say I…

gadym
- 125
- 3
- 17
3
votes
4 answers
How to get all possible values for SPFieldLookup
I have a lookup field in sharepoint which just references another list. I wonder how do I programatically enumerate all possible values for this field?
For example, my lookup field "Actual City" refers list "Cities" and column "Title", I have 3…

Anton Polyakov
- 331
- 3
- 13
3
votes
4 answers
Problem with DisplayPattern in SharePoint 2010?
I am adding a new field to a list using the AddFieldAsXML method of SPFieldCollection. The method executes fine with no problem. And the column header shows up when I view the list; however the value never displays in the column. Here is what the…

user281254
- 161
- 1
- 2
- 6
3
votes
1 answer
SharePoint - 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?

Tschareck
- 4,071
- 9
- 47
- 74
2
votes
1 answer
Validate Custom Sharepoint field if Empty?
I'm using Sharepoint 2010 .. with a custom field in visual studio 2010.
I created a custom field. This particular one is a datetime field ("Termination Date"). I want it to fail validation if it is blank and another field ( "Contract Terminates"…

Benjamin Callin
- 21
- 3
2
votes
1 answer
Get value from SPFieldUser with AllowMultipleValues fails only in a Timer Job
This one is weird.
I'm executing this code in a Timer Job in SharePoint 2010 ...
...
// Get the field by it's internal name
SPField field = item.Fields.GetFieldByInternalName(fieldInternalName);
if (field != null)
{
SPFieldUser userField =…

Sigurbjörn
- 421
- 6
- 9
2
votes
2 answers
WSS3 - setting a default value on a SPFieldType.Boolean after creation
I'm using WSS3 and C# to create site and I am creating a class to change fields on lists after they have been created. I have already created an SPField.Boolean type with no default value, but after upgrade I need the default value to be set to…

rgimmy
- 293
- 7
- 15
2
votes
2 answers
c# sharepoint how to set a FIELD Value of SPListItem with FIELD Value from other SPListItem?
I want to upload mulitple Documents (Files) into a Sharepoint FOLDER.
During the "ItemAdded" Event I want to 'copy' the FIELDS of the Parent Folder
(SPListItem) to the current (uploaded) Item.
When I check for the FIELDS of the current Item, all of…

Steve Rabbit
- 45
- 1
- 5
2
votes
1 answer
SPField custom attributes in schema
I'm trying to decide whether it is possible to store custom attributes in a SPField's schema XML.
If you look at the .xsd for the 'Field' element in SharePoint, there are a slew of attributes. The last one in the attribute list is…

CMN
- 259
- 2
- 12
1
vote
1 answer
SharePoint - don't change Modified Date on Update
I'm currently deploying a SharePoint solution with publishing pages. These pages allow the user to select "Do not update the modified-date".
This is solved by a small controll placed on the page.

Steve
- 174
- 4
- 15
1
vote
0 answers
Is it possible to extend SPFieldUrl to have more properties like url or description, to create a custom field type?
Url field type has more than one property : something like url, description. I want to know that how can I extend url field type(or some other field type that have more than one property) to create a custom field type with more than one property?

hossein hashemian
- 311
- 2
- 11
1
vote
3 answers
Programatically changing field order in Sharepoint 2007 list
I'm adding in two new fields into an already existing Sharepoint list programmatically through a feature. The fields are being added successfully but I have been unable to adjust the column order.
This task is done simply through the UI by going to…

Matt Shaver
- 171
- 2
- 3
- 12
1
vote
1 answer
SharePoint Custom Field - is it possible to handle item deletion event?
I'm expanding SPFieldText and BaseFieldControl to create a custom field. The field saves some data externally (for example, on a database or on another list)
Within the control I'm able to handle Edit and New events (using ControlMode).
I'd like…

Kobi
- 135,331
- 41
- 252
- 292
1
vote
1 answer
SPFieldType of a yes/no (check box) column in a sharepoint list
I want to know if I added a yes/no (check box) column to my list in my sharepoint website and then let's say in visual studio I wanted to retrieve data from this column what is the equivalent SPFieldType of this column.

Joy
- 1,707
- 7
- 29
- 44