Representation of a list item within the SharePoint API.

learn more… | top users | synonyms

0
votes
1answer
416 views

Change a list item's “Manage Copies” destination URL programmatically

I'm trying to write a PowerShell script that goes through every item in a document library and updates the "Manage Copies" destination URL to a new location. Is there any way to achieve this ...
4
votes
3answers
4k views

How to get SP.Folder for SP.ListItem in SharePoint 2010 JavaScript Client Object Model?

I have a custom button on ribbon for document library and need to disable it if current SPListItem is an empty folder. To disable button I use EnabledScript attribute of CommandUIHandler. I can get ...
1
vote
0answers
454 views

Problem with Refresh button on External data column

I'm struggling with refreshing items on list with external data. So far I have been able to make the refresh button work, but only when I add items to list in a standard way (via browser). When I add ...
0
votes
3answers
1k views

Sharepoint 2007 - Multiple Lines Text Size

I am using SharePoint List to capture values from the form. How many characters does multiple lines text field supports in sharepoint custom list? It asks me how many lines, while creating the ...
2
votes
2answers
817 views

How to find a file with name = X in a SPList

Looking for recommendations. Have a file in a document library with name x.txt. In a workflow code behind, I need to get the file to read its contents. What is the best/most efficient way to do ...
0
votes
1answer
1k views

Summary Task in Task List - Display Name

Hello I have a Task List, and I want to add items to it programaticaly in C#. I have a problem with adding a summary task. Now I figured out how to add such item: var myList = ...
5
votes
2answers
1k views

SPListItem.SystemUpdate updates SPListItem.File.ModifiedBy

As can be seen from the debug image when I call SystemUpdate(false) of a SPItem, that SPItem's File object's ModifiedBy attribute changes to "SHAREPOINT\system". Sorry, it's a bit weird way to ...
2
votes
1answer
299 views

Duplicates of SPListItem when two quick requests occur

We got code, running on page load. That code asks certain SPList for its items by CamlQuery, which gets only items with specific (current) user in one field (field A) and with some value in other ...
3
votes
1answer
562 views

How can I make sure that only one of two fields is filled out (ListItem)?

I have custom SharePoint list with several fields. Two of the fields are TargetPage and ExternalURL. At the moment the user is allowed to fill out both of them if he want to, and I want to deny that. ...
1
vote
2answers
191 views

Is it possible to update the searchindex for only one item?

Is it possible to update the searchindex for only on specific item. I'm search some tasklists through keywordsearch and showing them in a webpart. Then I have a custom action which changes the status ...
4
votes
2answers
3k views

Locking SPListItem for entirely server-side update

I am using code similar to the following to apply an update to an SPListItem, after necessarily elevating to System privileges on said item. Because this can be called multiple times for the same ...
0
votes
1answer
211 views

SharePoint 2010 - Read list item from Central Adminstrator list

I have created list (say List1) on Central Administration Site. I would like to read the title value from that list programmatically. How can I do it? I don't want to hard code the URL of central ...
1
vote
1answer
448 views

retrieving form values from NewForm.aspx?source=/_layouts/blah.aspx

I'm building a system that shows a list's NewForm.aspx to an anonymous website visitor, which they can complete and submit. The URL to the form includes "?source=/_layouts/blah.aspx", so after the ...
1
vote
2answers
205 views

GetItems(cQuery)

The following code seems to be working. Basically, I have multiple items in a document library and I need to run a cleanup PS. Do I need to add Dispose as I am not running under the Using context? ...
0
votes
3answers
1k views

ArgumentException with Export-SPWeb Lists

PS C:\Users\Administrator> Export-SPWeb "http://win-oql2facn6h8/" -itemurl "List s/Disney" -path "c:\Backups\disney.cmp" Export-SPWeb : ...
3
votes
2answers
3k views

Invalid SPListItem. The SPListItem provided is not compatible with a Publishing Page

Whenever I try to save or publish or check in the web-interface, I get this error. The test-environment did not have this issue, and I've only added a single web part to the page and tweaked the CSS ...
2
votes
1answer
850 views

Search Optimization on SPListItemCollection

I have an SPListItemCollection (Thread Discussion Collection) that consists of almost 20,000 items. Each SPListItem (Thread Discussion) on the SPListItemCollection contains a sub SPListItem(Thread ...
5
votes
1answer
2k views

ItemUpdated event handler runs four times

I have a list in the rootweb, and a list in a subweb. I want to update/add when something changes in an item in the subweb. This method is invoked in an ItemUpdated event receiver. The problem is that ...
1
vote
3answers
2k views

Item name / title when creating a folder

I am trying to create a list item with a folder content type by setting it's content type id to a folder content type id. The folder is created successfully but the title is set as 1_.000, 2_.000 etc. ...
8
votes
2answers
611 views

Is it possible to create a “Link to a Document” in a Document Library using a CAML Batch Command with UpdateListItems?

I have a Document Library in WSS 3 which has the "Link to a Document" content type enabled, and I want to use a batch command (via lists.asmx updatelistitems) to create a series of links. Here is the ...
1
vote
2answers
139 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
342 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
887 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
412 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
685 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
320 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? ...
4
votes
2answers
3k 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" argument(s): ...
1
vote
2answers
386 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
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 ...
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
2k 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
855 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
674 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
286 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
439 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
188 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 ...
11
votes
2answers
11k 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
772 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
289 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 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 ...
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
5k 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
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(); ...