The operation could not be completed because item was removed from the gallery

This is common Webpart deployment error

Some time after deploying the wsp package containing webpart doesnot work properly.

When tried to add into the webpart it throws error:-

 The operation could not be completed because item was removed from the gallery

 To solve this problem go to webpart gallery delete the webpartentry from the gallery and then deactivate and activate the webpart feature.

 

InfoPath Form Library doesn’t allow to save any changes

Sometime InfoPath form library doesn’t allow to save the changes made to list item.

It throws following error:-

ExceptionType: ‘SPException’ ExceptionMessage: ‘Changes could not be saved into the
document.
The property to change is read-only for the document’s content type, or the
document is missing XML elements
or attributes where the changes would be saved.
Try editing the document  in a Windows SharePoint Services-compatible XML editor
such as Microsoft Office InfoPath.

This problem happens when the Form Library contains several property promoted fields
and the form for which changes were made and supposed to save , doesn’t contains those
fields and blows up when trying to save.

To fix this issue, double check content type definition and linked field associated with that.

Some time problematic field got created, doesn’t remove just by deactivating/Uninstall of
feature because instance got created.
This is important to find the instance and remove it then use feature to install/activate to work properly.

Action Item to resolve this issue:-

To fix the problematic filed which blows up,
1. Create a unit test to identify the fields used in Infopath Form
2. Now Remove the filed column mapping from the content type associated in a list
3. Similarly remove the field mapping from content type in Site Collection
4. Remove the content type from the Site Collection
5. Redeploy the content Type so that the Push Down mechanism will update the child
content type

And this solved the problem.

Problem with multiple Infopath forms Associated to a Forms library.

In Forms Library some time field with type Note does not accepting
long text  for some InfoPath form and on the same time it accepts
long text for other InfoPath form.

It will give following error

ExceptionType: ‘SPException’ ExceptionMessage: ‘Invalid text value
A text field contains invalid data. Please check the value and try again.’

This types of problem occurs to those forms whose Field definition was
not properly associated to Infopath form content type.

To fix this strange behaviour check field definition in infopath form content type.

If the Form Template created using contentype definition then link
the field with that. If was created without content type definition then
go to content type definition gallery and find the content type for the
legacy deployed infopath form which got created when published.

After getting the name of the content type link the Field
and then it will start working  correctly.

How to handle limitations in SharePoint 2010 BCS when working with large data

In SharePoint 2010 when connecting with large data, it will give you error because throttling limit is set and default is 2000,
however this is also configurable using Powershell, but this is also not the solution and also not going to fit in all
scenario, when someone want to display 20 records in a web part and BCS is  fetching all the record.

This can be handled using object model by invoking BDC Metadata Method Instance and by passing input parameter
and this input parameter can be used to filter the number of record to display.

By using this approach it become quiet handy to full control over the method to execute and input parameter can
be set dynamically which can passed to Stored Procedure /or Custom method where these input
parameter can be used to limit the number of records to display ….

SharePoint Caching

The SharePoint Server Caches run on the front-end web servers of your SharePoint Server farm.
Each cache maintains copiesof data locally on the front-end web server so that user requests can be serviced by using the
cached data where appropriate, avoiding excessive traffic between SQL Server andthe front-end web servers and
CPU load on the front-end web server, thereby improving performance and scalability.

Following options can be used to Caching in SharePoint

1. BLOB Caching
2. Output Caching
3. Object Caching

1. The BLOB cache

The BLOB cache addresses this aspect of files stored in SharePointServer by caching the content on the front-end web servers.
By storing files in SharePoint Server but caching them by using the BLOB cache, page assets can be served quickly and centrally
managed at the same time.

BLOB caching is most useful in the following scenarios:
o    Frequently accessed page resources such as JavaScript, CSS and page images
o    Rich media, especially larger files, such as videos

BLOB caching is less useful in the following scenarios:
o    Files that are infrequently accessed
o    Files that are modified frequently

To add a new file, the BLOB cache pays a first hit penalty of around five times more requests to SQL Server
than with the BLOB cached disabled.  These extra round trips are to fetch permission information and other metadata so
the cache can serve the file securely

 

Automate Page creation using Feature Receiver

1. Create SPWeb web object
2. Create PublishingPageCollection publishingPages object
3. Create PageLayout pageLayout object

//Page Name//
string
pageName=”MKSDemo.aspx”;
string pageTitle=”Demo Title”;

web.AllowUnsafeUpdates = true;
PublishingPage currentPage = publishingPages.Add(pageName, pageLayout);
currentPage.Title = pageTitle;
currentPage.Update();
currentPage.CheckIn(“System Created : ” + pageName);
currentPage.ListItem.File.Publish(“System Published : ” + pageName);
currentPage.ListItem.File.Approve(“System Approved : ” + pageName);
web.AllowUnsafeUpdates = false;