Tag Info

Hot answers tagged

8

AS PER MSDN SPList.ItemCount: The value of the ItemCount property includes folders within a document library, as well as files within subfolders. The value of the Count property of the SPListCollection class does not include folders. SPListItemCollection.Count: Gets the number of list items in the collection, excluding folders. BUT Although it's ...


7

If fetching of item["ID"] instead of 'Title' works AND If you are using the SPQuery object. Then, include the columns that you want to fetch in the ViewFields property of SPQuery. This will resolve your issue. Reference: ...


4

You need to use the $expand option in your query string. siteUrl + "/_api/lists/getbytitle('" + listName + "')/items?$select=NameOfLookup/FieldYouWant&$expand=NameOfLookup/NameOfFieldYouWant" So yours would be: "/_api/lists/getbytitle('" + listName + "')/items?$select=$expand=status_x0028_test_x0029/Title&$expand=status_x0028_test_x0029/Title ...


3

What you have described is the functionality of Document Libraries. You can provide a custom document template for the library. (It may make more sense to provide a custom document template at the Content Type instead of the library.)


3

So you have UniqueId of the item and the Url of the library, right? You can get the item in one of the following ways: Get the list from the Url SPList list = web.GetList("http://mysharepoint.be/MYDOCUMENTSLIBRARY"); SPListItem item = list.GetItemByUniqueId(yourGuid); Get the list form the Url of a webpart page that has a web part for your list as first ...


2

If you look at database Wss_ContentXXX to table dbo.AllUserData in fields tp_Modified and tp_Created milliseconds always equals to 000. For seconds you can use the following formula with a calculated field: =TEXT(Created,"dd-mmm-yyyy HH:MM:SS")


2

For lists and libraries, SharePoint locks the URLs to whatever value the name was when the list/library was created. Later, if you rename the list/library, it will reflect the new name everywhere except in the URL. From your description, it sounds like you are saying the URL..... http://mysharepoint.be/MYDOCUMENTLIBRARY .....works, but the library name ...


2

Instead of placing the spItem.Versions in foreach statement. out the versions in a variable. var versions = spItem.Versions; foreach(var item in versions) {} because whenever you call spItem.Versions, SharePoint will make a call to get all the versions.


2

The fastest would be SPList.GetItems Method (SPQuery, String). However, in case you are referring to large lists and libraries, take a look at Handling Large Folders and Lists.


2

You could use SP.File.checkOutType property to determine whether document is checked out of a document library REST $.ajax({url: "/_api/web/getFileByServerRelativeUrl('" + docUrl + "')/checkOutType", headers: { "Accept": "application/json; odata=verbose" }, success: function(data) { if(data.d.CheckOutType == 0) { ...


2

There are two options in sharepoint to delete the listitem: listitem.Recycle() deletes the list item and puts it in the recycle bin listitem.Delete() deletes the item permanently If you delete a document in SharePoint using the User Interface, it’s being moved to the Recycle Bin, so that it can be restored if necessary. Calling the SPListItem.Delete() ...


2

If you want to get the collection of "field_name + field_value", you can try: var fieldValues = currentItem.get_fieldValues(); It returns an object, the object key is field name and the object value is field value.


2

You are getting the field, not it's value. To get the value use this: item["Title"]


2

Change the ConvertLoginName method to: public static SPFieldUserValue ConvertLoginName(string userid) { // Try to get the SPUser value if userid is a user or AD group that has been imported into SharePoint by the UPS. try { SPUser requireduser = _web.EnsureUser(userid); SPFieldUserValue uservalue = new SPFieldUserValue(_web, ...


1

We are in a similar situation. We recognized that in some case our permissions are unqiue but allways the same :) (unique permissions in some flow was always setting the same 2 AD groups). This is helpful as we can move these items down into a folder that has the unique permissions without having to assign it to each item individually, reducing the amount ...


1

You can use Sharepoint paging to get next 5 items on scroll event. In the sample code previous and next actions are defined(for next and last listitems). You need only next button click code . So just define your scroll event and use btnNext click code defined below: var context, web, spItems, position, nextPagingInfo, ...


1

your writing to a string that resides on client memory! your not writing to a html control on the page that is on the client so it will never show! how about witin the cewp create a label with JS and then within the method write to it using the innerhtml? first create the control and then add the values to it using the script method you made. <label ...


1

Finally i have found the issue! There was a column in the list which i was updating, which had a column validation i removed that validation and found that i'm no longer getting the SPListDataValidationException for items with past dates(overdue). But Now my question is that, is there a way where in you can disable a column validation at run-time in code ...


1

Try this: $urlValue = New-Object Microsoft.SharePoint.SPFieldUrlValue("") $urlValue.Description = "This is an awesome description" $urlValue.Url = "http://MyUrl.com" $item["URL"] = $urlValue $item.update() Reference: http://sharepointnadeem.blogspot.com/2011/10/add-item-to-sharepoint-links-list.html


1

Use SPUtility.CreateISO8601DateTimeFromSystemDateTime to create relevant DateTime string. DateTime firstDay = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1); string firstDayValue = SPUtility.CreateISO8601DateTimeFromSystemDateTime(firstDay); string firstDayValueplus1Month = ...


1

15 workflows will run at a time and the rest will be queued and will run as soon as the number of running workflows drops below 15. By running workflows I mean workflows that are currently using CPU and memory, not all those that have been started before and are in "In Progress" state because some of them may just be sleeping (for example waiting for task ...


1

Technically, views are nothing but saved collaborative markups that describe the contents to be shown. The motivation behind various overloads for GetItems() is to ease the task of getting items and reduce the knowledge you need to use SharePoint Api. If you're not happy with writing CAML you can build a view in the front-end and use its name in the ...


1

The speed of both is almost the same as both leads to the same complex code which takes 3 parameters: list, query and viewname. The second method is for creation of 1 empty SPQuery object faster. From my point of view the drawback of first method is that you must construct or have prepared the view.


1

When I use web service operations for batch processing in 2010, my batch looks much different: <Batch OnError='Continue'> <Method ID='1' Cmd='Delete'> <Field Name='ID'>1234</Field> </Method> <Method ID='2' Cmd='Delete'> <Field Name='ID'>1235</Field> </Method> ...


1

For SharePoint 2013: properties.Cancel is now depreciated, use Status instead. Options for status are: CancelNoError Continue CancelWithError CancelWithRedirectUrl (Obsolete - Default list forms are committed through asynchronous XmlHttpRequests, so redirect urls specified in this way aren't followed by default.) Example: properties.ErrorMessage = "My ...


1

I found a solution to the original problem that was posted here, it took me whole day struggling with xml returned by query. Solution is, In ViewFields, terminate the internal name up to 32 charachters. And then, while getting value, use the internal name terminated up to 32 chars. This is definately poorly tested code by Microsoft pushed in SP 2010. ...


1

Did you try like this: item[FieldNames.Offices] = selectedOffices;


1

It is my understanding, and borne out by the comments here, that SharePoint Date fields don't actually track milliseconds. Sorry.


1

You can use EffectiveBasePermissions to get the effective base permissions of the current user for a particular list (MyList.EffectiveBasePermissions & SPBasePermissions.ViewListItems) != SPBasePermissions.EmptyMask For a particular item (normally under broken inheritance): Listitem.DoesUserHavePermissions(myuser, SPBasePermissions.ViewListItems) ...


1

instead of: SPContext.executeQueryAsync(GetListItemById); do: SPContext.executeQueryAsync(Function.createDelegate(this, this.GetListItemById_Successor), Function.createDelegate(this, this.GetListItemById_Fail)); http://msdn.microsoft.com/en-us/library/hh185007(v=office.14).aspx



Only top voted, non community-wiki answers of a minimum length are eligible