Thursday, October 31, 2013

Lookup Field : Invalid data has been used to update the list item. The field you are trying to update may be read only when using Copy.asmx

Hi All,

We are using Copy.asmx in SharePoint to upload files including metadata information. While doing so, we got error for People Picker field as shown below:

Lookup Field : Invalid data has been used to update the list item. The field you are trying to update may be read only.

Resolution:

1. We need to set FieldType for FieldInformation object to User as shown below

2.  Add "-1;#" before User ID


Once this is done, the error disappeared and user id is properly copied to People and Groups field. Hope this helps some one. Cheers!!!


Folder-Level Permissions in SharePoint List

Background:
We often get requests to limit list items to a section of people like HR, IT, PMO, etc. HR should see fewer items that other groups should not and vice versa. The solution for this problem appears straight forward (by breaking permissions of items and assigning them to corresponding SPGroups). However, this approach leads to serious performance issues for a large number of items and can bring entire SPFarm down!

Why?
The recommended number of unique security scopes for a SPList is 5000. When the number of unique security scopes for a list exceeds the value of the list view threshold (set by default at 5,000 list items), additional SQL Server round trips take place when the list is viewed, and this can adversely affect list view performance.

Resolution
Possible workaround for this problem is to have folder level security in SPList. For the above problem statement, we will be having folders for HR, IT, PMO in SPList and HR folder will be accessed only by HR and Admin SPGroups (same approach for other folders as well)
With this change, all items under HR folder will inherit permissions from HR folder instead of having separate permissions. Below is the comparison between item level permissions and folder level permissions

List Item Count: 2000

Scope
Item count
HR
500
IT
600
PMO
900

Without using Folders –We would be having more than 2000 unique security scopes
With using Folder – We would be having 4 unique security scopes (Permissions for List itself and Permissions for 3 folders)
 

Partial Page Exclusion in SharePoint Search

Background:

Out of the box search results in SharePoint shows unnecessary data such as navigation, left nav, footer, right nav etc., that may not be useful to end user. Fortunately, it’s easy to exclude those items from appearing in search results by using a technique called “Partial Page Exclusion”.

How to use:

Just include a class called “noindex” for the items that needs to be excluded from search results. This tells the crawler to ignore those items. Here is a sample example in which crawler is forced to crawl only content present in body class. All other items are ignored.

<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<div class="wrapper">
<div class="header noindex">
// Header Data
</div>
<div class="topnav noindex">
// Navigation
</div>
<div class="body">
// Header Data
</div>
<div class="footer noindex">
// Footer Data
</div>
</div>
</body>

</html>