Monday, December 1, 2014

Migrate MOSS 2007 Custom webpart to SharePoint 2010


First Get MOSS 2007 code.

Open VS 2010
Create new Empty SharePoint Project.
Add New webpart.
Now delete .cs from solution.
Right click on Web part folder Add existing item.
Select .cs file from old MOSS 2007 code folder.
Save.
Build.
Resolve all references and errors.
Deploy...


Unable to display this web part. To troubleshoot the problem, open this web page in a Microsoft SharePoint Foundation-Compatible HTML editor such as Microsoft SharePoint Designer

Error: Unable to display this web part. To troubleshoot the problem, open this web page in a Microsoft SharePoint Foundation-Compatible HTML editor such as Microsoft SharePoint Designer. If the problem persists, contact your Web Server Administrator. Correlation ID.
Solution
This error occurs when the “AllowPersonalization” property of the Web Part Zone is set to false, and a user with less privilege tries to access the zone. This leads to the WebPartPageUsageException. This could be overcome by just setting the AllowPersonalization property to true.

Error parameter name ncolindex


parameter name ncolindex
This is a bug with SQL management studio and I need to use TSQL to attach the database
USE [master]
GO
CREATE DATABASE [WSS_Content_Databasename] ON
( FILENAME = N’E:\MSSQL\MSSQLSERVER.DB\Data01\WSS_Content_databasename.mdf’ ),
( FILENAME = N’E:\MSSQL\MSSQLSERVER.DB\Data01\WSS_Content_databasename_log.LDF’ )
FOR ATTACH
GO
if exists (select name from master.sys.databases sd where name = N’WSS_Content_databasename’ and SUSER_SNAME(sd.owner_sid) = SUSER_SNAME() ) EXEC [WSS_Content_databasename].dbo.sp_changedbowner @loginame=N’sa’, @map=false
GO

DATABASE Tuning

1) Return Multiple Resultsets

2) Connection Pooling and Object Pooling

3) Use SqlDataReader Instead of Dataset wherever it is possible

4) Keep Your Datasets Lean

5) Avoid Inefficient queries

6) Unnecessary round trips

7) Too many open connections

8) Avoid Transaction misuse

9) Avoid Over Normalized tables

10) Reduce Serialization

11) Do Not Use CommandBuilder at Run Time

12) Use Stored Procedures Whenever Possible

13) Avoid Auto-Generated Commands

14) Use Sequential Access as Often as Possible

How to set, Person or Group field to Empty or Null in SharePoint using JSOM


Today i was trying to set null value to Person or Group field.
It was not straight way..

Solution:

var objUser = new Array();
Assign empty array to column of type "Person or Group"
ojLstItem.set_item('MyPersonColumnName', objUser)
Loading...