Hot answers tagged list-item
7
You load multiple items. A conflict occurs. Collect all items you need and call "load". After you call load for all items, then run context.executeQueryAsync.
Save your selected items as a global variable (this.items):
function showTitles(urlColumnName) {
var context = new SP.ClientContext.get_current();
var web = context.get_web();
var lists = ...
4
Well, SPSecurity.RunWithElevatedPrivileges should do the trick.
Make sure, you create a new SPSite/SPWeb within the elevated code block:
var siteId = SPContext.Current.Site.ID;
SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPSite site = new SPSite(siteId))
{
//do things on the new site object
}
});
4
Navigate to corresponding Elements.xml, and you will notice Receivers element with ListTemplateId attribute, like this:
<Receivers ListTemplateId="100">
...
</Receivers>
What you need is to use ListUrl attribute instead, and point it to the specific list using provided url.
There is a how-to on this on MSDN:
...
3
I found a way. There is a class FieldUrlValue in the Client Ojbect Model for this type of situations. Here's how I implemented it:
ListItemCreationInformation lici = new ListItemCreationInformation();
ListItem item = list.AddItem(lici);
FieldUrlValue link = new FieldUrlValue();
link.Url = "http://some-address";
link.Description = "Some Address Title";
...
3
Try something like:
string siteUrl = "http://MyServer/sites/MySiteCollection";
ClientContext clientContext = new ClientContext(siteUrl);
SP.List oList = clientContext.Web.Lists.GetByTitle("Announcements");
clientContext.Load(oList);
clientContext.ExecuteQuery()
ListItem oListItem = oList.GetItemById(2);
clientContext.Load(oListItem);
...
3
Here is a script that gets the UniqueId of a list item:
<script type="text/javascript">
$(document).ready(function()
{
ExecuteOrDelayUntilScriptLoaded(
function()
{
var itemId = ....; // change to the real id
var listTitle = .... // the list title
var ctx = ...
3
I solved this by using a CamlQuery directly after creation to return folders with the same name as a ListItemCollection:
SP.CamlQuery query = new SP.CamlQuery();
query.ViewXml = "<View Scope='RecursiveAll'>" +
"<Query>" +
"<Where>" +
"<And>" +
...
2
SPExportObject/SPImportObject can be used to migrate the list item, but only issue that you need to take care is if you export an item from a database (e.g. a list) without exporting it's parent, then the exported item will become orphaned in the package. A package can contain multiple different orphaned objects (e.g. if you export multiple different lists ...
2
This isn't supported by SharePoint, so you need to set specific permission on each item, which will only perform well if you have a limited number of items in the list.
The setting of permission, can be done:
Manually like this:
Open list with item
Select the item
In the ribbon click Item Permissions
In the ribbon click Stop Inheriting Permissions (and ...
1
try these block of code..it may solve your problem..
List<string> someStringList = new List<string>();
foreach(string sD in someString)
someStringList.Add(sD);
SPSite csite=SPContext.Current.Site;
SPSecurity.RunWithElevatedPrivileges(delegate
{
using (SPSite site = new SPSite(csite.ID,csite.SystemAccount.UserToken))
{
using ...
1
DocumentId is populated by "Document ID Service" feature in SharePoint that can be turned on and off at the site collection level which means that the field may or may not be populated. When active, it provides a way to locate the document regardless of its current name or location. Item Id provides a unique integer for the document within a specific list ...
1
This article seems to be helpful:
Enhanced Workflow Initiation Forms in SPD – Part II
Part I of it
Update:
This article seems to refer to SPD2010 workflow on Sharepoint Foundation 2010 while on Sharepoint Server 2010 (and before but not after ( * )) any created workflow is based on Infopath forms.
Read, for example in:
S.Y.M. Wong-A-Ton. 2 ...
1
Best practice wise, I would manually create a lookup field to your project task list (pointing the task id and displaying the task title). On your document library, you could add that field (mandatory if it's sole purpose is to store project task documents) so that whenever someone upload a document, that person has to fill the associated project task.
In ...
1
mikey,
This is not available OOB...
What you can do is create a new Custom Action that will add a button to the ribbon right after the Edit button, follow this on making custom action:
http://msdn.microsoft.com/en-us/library/hh500259.aspx
In custom action, call a Javascript function in which you can get all the items selected by user, see this URL:
...
1
BlueChippy,
That really depends upon the views and data usage, but you need to keep in mind the future changes you may need to do for both - if they are not going to change and have almost same kind of data as you said.. And there are several views in which data from both should be populated and filters should be applied on both data or something, then you ...
1
1 - As far as I know, Created and Modified fields are read only fields on SharePoint, so even if you're accessing in the right way, you wont be able to update their values.
2 - By all means, avoid using web.Lists["ListName"]. Instead use web.Lists.TryGetList("ListName"). Your app/script performance will improve
1
Try this:
Console.WriteLine(listItem["Title"]);
If you want to work with the DisplayName, you should do it like this:
ctx.Load(listItemCollection, items => items.IncludeWithDefaultProperties(item => item.DisplayName));
The following link should help you out:
...
1
You can assigne the unique permissions for an user, but
When there are many unique permissions in a list then it can reduce
the overall performance of the query so that isn’t recommended. The
number of unique permission in a list gets bigger over time and that
reduces the performance. While the limit is by default 50,000 it is
ideal if you make ...
1
Wrapping the Query inside "View" tags fixed the issue. Its only returning according to the filename now.
q.ViewXml = @"<View>
<Query>
<Where>
<Eq>
<FieldRef Name='FileLeafRef' />
...
1
If you want to find out which items were deleted prior to this day, and auditing is not enabled for that list, there is no way. Those items are completely gone. Even in SharePoint's ChangeLog all you will find is that an item was deleted at some point, but no indication which (other than its ID).
Turn on basic auditing (beware database usage), or implement ...
1
Some other options would be using a workflow to move data around, assuming it's within the same site collection. You can also use Content and structure to move items from list to list, depending on your SKU.
Another option is to use Information Rights Management (IRM). IRM allows you to specify retention times based on dates. When a specific time range ...
1
Managed to remove the buttons from the WebPart. I've stuck this in the WebPart:
protected override void OnInit(EventArgs e)
{
Ribbon currentRibbon = SPRibbon.GetCurrent(this.Page);
foreach (string rid in litsOfRibbonIdsToExclude)
{
currentRibbon.TrimById(rid);
}
}
with ...
1
Does your list have workflows attached? May be the workflow history list is creating the problem for you too.
Its kind of a known issue in SharePoint 2007 if its workflow problem. Read this article for a clear understanding.
And another update for this issue is that it might occur for only sites having 'Publishing feature' enabled. (Note: its the site ...
1
You need to specify the Url and pass tokens like ListID, ItemId etc in a child element called UrlAction as shown here:
http://hristopavlov.wordpress.com/2008/12/08/urlaction-tokens-of-the-customaction-feature/
and
http://www.manojn.com/blog/post/EditControlBlock-(ECB)-menu-item-in-SharePoint-Wiki-and-Blogs.aspx
1
You can use a feature receiver for this, as described in the answer at:
http://stackoverflow.com/questions/7091281/sharepoint-2010-adding-sample-data-to-user-field-type.
This way you can generate valid ID+Name sets for your rows.
1
You could certainly use a custom editform, and include use of Client object model or SPServices to do the save action itself within the form. Clicking the 'Save' button in the ribbon will close the window, no way round that really.
Another method (which I'd probably do) is build a custom application page that has an update panel that does the logic of doing ...
1
If you really want to accomplish this, you can use client side scripting to convert the behavior of the check boxes to radio buttons (i.e. a user clicks a check box, all others are deselected).
I just ran a test where I hide all the check boxes using JavaScript, but doing so prevented me from making any selections...so the check boxes need to stay, but ...
1
Does the item have a it's own ACL's, i.e. it's security has been "decoupled" from the parent list?
Does it have a lot of lookup columns?
Is Project Server installed (or deinstalled) and is sharepoint assuming it should do some extra project server stuff it shouldn't?
Are there any audiences assigned to the item?
An item level query will only grow this ...
1
If the results are from different Sites > Webs > lists etc, then you'd have to go custom by writing a custom web part. In this web part you'd have to write some CAML to query Sharepoint for specific site templates or specific sites/lists. If you dont like CAML, you can iterate using something Like Linq to Sharepoint or normal Iterations over SPWeb/SPSite ...
1
SharePoint doesn't have OOTB mechanism for capturing 'Item is displayed' except auditing. Using auditing (as Rob pointed in his answer) is way to complicated. I never implemented similar solution so I will agree: In theory it is possible.
One other option is to build custom display page (application page), attach it to your list (content type) as default ...
Only top voted, non community-wiki answers of a minimum length are eligible

