Tag Info

Hot answers tagged

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

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 ...


3

Instead of creating a new SPFieldUserValue find the one in the SPFieldValueCollection you want to remove like this: private static void DeleteUserFromList(SPUser userDeleted, string fieldName, SPListItem item, SPWeb sPWeb) { SPFieldUserValueCollection Users = (SPFieldUserValueCollection)item[fieldName]; SPFieldUserValue DeletedUserValue = ...


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.)


2

This works fine with Powershell! Export-SPWeb -Identity http://win-oql2facn6h8/ -ItemURL /Lists/Disney -Path c:\Backups\disney.cmp


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

When updating a list item you should use the uri from the metdata of the list item you want to edit results[i].__metadata.uri. $(document).ready(function () { var defaultClient = OData.defaultHttpClient; var spClient = { request: function (request, success, error) { request.headers = { "Accept": "application/json;odata=verbose", ...


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

You can use AjaxFileUpload. Have a look at the demo on below link. http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/ajaxFileUpload/ajaxFileUpload.aspx


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

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

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

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


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

Try Console.WriteLine("{0} -- {1}",item[SPBuiltInFieldId.Department] == null ? "N/A" : item[SPBuiltInFieldId.Department].ToString(), item[SPBuiltInFieldId.Office] == null ? "N/A" : item[SPBuiltInFieldId.Office].ToString()); In the event receivers you can set those two columns. With calculated columns would be great but as far as I know that's not ...


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


1

I've done some large list stuff as well - not 100,000 items worth, but definitely more than 1000 - and I haven't seen any dispose issues with SPLIstItem. I do know that SharePoint attempts to thread processes behind the scenes when it can; is the OWSTIMER.exe getting so large that it crashes your system, or are you just concerned that it might be getting ...


1

Since the problem seems to be related to the Publish of the file, try this approach: SPFile fileDest = libDest.RootFolder.Files.Add( urlDestFile, streamFile, hashSourceProp, userCreatedBy, userModifiedBy, dateCreatedOn, ...


1

To create a SPUserField in PowerShell you can use $user=New-Object Microsoft.SharePoint.SPFieldUserValue(web, $userId, $userName) $item[[Microsoft.SharePoint.SPBuiltInFieldId]::Editor] = $user $item[[Microsoft.SharePoint.SPBuiltInFieldId]::Modified_x0020_By] = $user $item.SystemUpdate($false);


1

You must change your query to: "<Where><Eq><FieldRef Name='User' />"+ "<Value Type='User'>"+ currentUser.LoginName +"</Value></Eq></Where>" See the link for details


1

Try the below code, SPFieldUserValueCollection fuvc = item[fieldName] as SPFieldUserValueCollection; foreach (SPFieldUserValue value in fuvc) { if (value.LookupId == userDeleted.ID) { fuvc.Remove(value); item[fieldName] = fuvc; item.Update(); break; } } Hope this helps you.


1

Have you seen this answer? It's newer Office files that appear to be using this format. SharePoint is quite happy reading and writing them to/from this format, however you'll need to do a bit of work if you want to convert the hex to a DateTime value. The hex value represents the number of ticks since 1st Jan 1600, so you may have found that your dates ...



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