Representation of a list item within the SharePoint API.

learn more… | top users | synonyms

1
vote
2answers
146 views

Modifying ID (index) of listitems

So I ran into a situation where I have two lists containing the same information but in different languages (don't ask me why they chose to do it this way). Each item links through a workflow-created ...
1
vote
0answers
387 views

Sharepoint - Programatically check Project Task list hierarchy

I have a Project Task list in Sharepoint that contains Summary Tasks, which contain Tasks. What I would like to do, is to check which task items of this list are children elements of which summary ...
0
votes
1answer
1k views

get discussion message url

I have an own UI for discussion messages. The issue is the Url of the actual SPListItem doesn't help: SPListItem message = //get message var url = message.Url; //returns "/Lists/forum/hello/2.000" ...
1
vote
2answers
439 views

ListItem Versioning Differences

Does anyone know how to programmatically determine if any non-system fields have changed between ListItem versions? I realize that I could iterate through the fields between each version and if I see ...
2
votes
6answers
4k views

How can I auto-increment a column?

I am working on a solution where I have a list with a column named LogIDNumber. For each new entry in the list, I would like to increment the LogIDNumber by one. I could use the ID generated by ...
2
votes
1answer
744 views

SPListItem removing HTML attributes?

I want to add this to an SPListItem HTML field (Multiline text) <a href="#" onclick="OpenDispPage('Table 1.1', 'table');" >Text</a> and this is what SharePoint makes out of it when I ...
1
vote
1answer
330 views

How to detect SPFieldLookupValue from an SPListItem?

I have a SPListItem, with different fields (string, lookup, etc), that I have to iterate them and do different actions depending of the type. How can I detect if value is type String or type Lookup? ...
7
votes
2answers
4k views

PowerShell: Update People Picker Field with domain\Username

I'm trying to get this to work in PowerShell: $spListItem[$ppField] = "domain\username" $spListItem.Update() This gives me the following error: Exception calling "Update" with "0" ...
1
vote
2answers
425 views

Updating an SPListItem without knowing SPSite or SPWeb

I'm building a custom web part that is running an SPSiteDataQuery. I will be running this query across all site collections, and displaying the results, together, in 1 web part. Users interacting with ...
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 ...
1
vote
3answers
2k views

Getting “Object reference not set to an instance” but column name exists

The NewsCaption field exists (both display and internal name is NewsCaption). I even saw it exists when I went to watch window and show this field listed in the SchemaXML for the fields element. I am ...
0
votes
2answers
3k views

Need Help - How to update listitem of type User in sharepoint 2010?

I am trying to update a list which is having User content type field, where I am saving users name selected from people picker. Now my requirement is to add/remove a particular person in that list ...
5
votes
2answers
940 views

Problem with CAML SPQuery ItemChildCount result

I know that this query works fine SPQuery query = new SPQuery(); query.Query = "<OrderBy><FieldRef Name='ItemChildCount' Ascending='FALSE' /></OrderBy>"; But my ...
3
votes
2answers
2k views

Updating a ListItem that another user has edited

I have an event receiver that creates/updates/deletes publishing pages in a publishing library. In ItemUpdating, I get a handle to the page's underlying ListItem, change some of its properties and ...
0
votes
1answer
813 views

Microsoft.SharePoint.SPException: The security validation for this page is invalid

I used SharePoint Designer 2007 to make a Workflow that copy item of Calendar list to Contact list when I create a new item. Then I run my code that new item in Calendar list. Unfortunately, I get a ...
0
votes
1answer
305 views

Copying a document between libraries breaks QuickParts

I am copying a file between 2 libraries which contain the same fields. So basically the source library serves as a template library. After the file is copied i update the field values in the ...
3
votes
1answer
473 views

How can I undelete records from a SPList programmatically?

There is a SharePoint List from which many records have been deleted using CAML. The records are available in the Recycle Bin. Is there an way to recover the records using scripting/CAML etc ? Since ...
3
votes
3answers
2k views

Find creation time for list elements (including documents)

I know SharePoint has some hidden fields for list items. I need to check the timestamp for when a list element was created, is this possible? The reason is I must allow the item to be edited for the ...
4
votes
2answers
198 views

Editing list item with custom field creates a new list item on current date and time

Based on How to add new field to custom list (See edit!) It is a different question relating to the above so thought I'd create a new question as the above was technically answered. But after adding ...
12
votes
2answers
14k views

Safest way to get a date from Sharepoint into a C# datetime field, using object model?

If I have a Sharepoint list item with a date field. How can I get the field value populated into a c# datetime object? For example: DateTime validfrom = Convert.ToDateTime(item["validfrom"]); ...
4
votes
1answer
202 views

Delayed Writes & Implications for Cross-Process Synchronization

Simple scenario: OWSTIMER creates a new SPListItem, populates it and calls .Update(). It then fires an HTTP request over to w3wp.exe (front-end app-pool) to invalidate an in-memory cache held there. ...
1
vote
1answer
1k views

How to get checked out SPListItem for current user by file name using CAML query?

I use SharePoint 2010 RTM and now I'm trying to get SPListItem, which was checked out by current user, using code like this: query.Query = "<OrderBy>" + ...
1
vote
3answers
861 views

Exporting SPList

I'm iterating SPWebs and SPLists. When those lists fulfil specific requirements, I would like to export the lists in code, and later import them to another SharePoint environment (using code). How ...
3
votes
2answers
2k views

OnWorkflowItemChanged not firing when using SPListItem.Update()

I am experiencing a very weird behavior: After using SPListItem.Update() the OnWorkflowItemChanged is triggered (so the title is misleading), but sends the workflow into a sleep state it never wakes ...
2
votes
3answers
2k views

Attempt to get property CheckOutType of SPFile cause 'System.NullReferenceException' exception

I have a strange situation: If the "Require Check Out" and "Create Major Versions" options are switched on for the current Document Library, then when I try to get the CheckOutType property I receive ...
3
votes
2answers
295 views

SP2010 splistitem AND accessing css or style

I have an event receiver which adds splistitems from child sites to the parents site list (in a calendar). How do I access the css or style of an splistitem? I am wanting to color code the different ...
6
votes
1answer
2k views

Attach a file to the list item

I attach a file to the list item when it is updating and when new item added. Additional condition when item updating - if the file already exists, remove it and replace the new one. I receive events ...
7
votes
3answers
2k views

Multiple Lookup field , how to return better deliminators using object model?

I have a multiple lookup field, and when I do this: string myValue = oItem["MyLookupField"]; I get this string back: [id];#[displayText];#[id];#[displayText] or a real example: "5;#C3;#15;#P3" ...
3
votes
2answers
6k views

Set default value in a document library column via Powershell?

I'm looking for a powershell script that allows me to set the default value for a column in SharePoint. Thanks
5
votes
4answers
25k 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(); ...
13
votes
1answer
12k views

How to get a SPFieldLookupValue from an SPListItem?

When you get an SPListItemCollection from a SPList.GetItems(SPQuery) request, and the items have SPFieldUser or SPFieldLookup fields, what is the sexy way to get typed values, not the ...