Representation of a list item within the SharePoint API.

learn more… | top users | synonyms

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 ...
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
717 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
327 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? ...
1
vote
2answers
407 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 ...
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
909 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

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 ...
0
votes
1answer
746 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 ...
6
votes
1answer
2k views

Attach a file to the list item

I attach file to the list item when it updating and when new item added. Additional condition when item updating - if the file already exists, remove it and replace the new. I receive events ItemAdded ...
0
votes
1answer
296 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
460 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
193 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
13k 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
200 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
826 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
292 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 ...