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

If you go into the advanced settings for the list you can choose to ensure that users only see and edit their own items. Getting the items from the list for each user should not be an issue as long as each user does not have 1,000s of items.


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

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

Just to be sure, try to get the values from ItemUpdated event. Maybe the reason why that the values are not available is because they aren't exist yet.


2

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


2

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


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

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


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

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

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

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

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

It was how I did in one of my projects. TaxonomyField tf = currentPublishingPage.ListItem.Fields[NEWS_TAGS_COLUMN_NAME] as TaxonomyField; TaxonomyFieldValueCollection tfvc = currentPublishingPage.ListItem["Enterprise Keywords"] as TaxonomyFieldValueCollection; Read the Full article


1

Working with taxonomy fields can be tricky... In order to clear a value from a field: $taxField = $item.Fields["metadataField"] -as [Microsoft.SharePoint.Taxonomy.TaxonomyField] $taxFieldValue = $taxField.GetFieldValue(""); $taxField.SetFieldValue($fileItem,$taxFieldValue) $fileItem.Update() In order to set a taxonomy field you essentially need to know ...


1

I am unable to find the exact reason for the error: However pls go through the following points: 1) How to update a Readonly field. First set Readonly to false and update the field and then revert it back as: Field.ReadOnlyField = false; Field.Update(); 2) Updating the Lookupfield: new SPFieldLookupValue(1, "ASP.Net");



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