Developer Test on SharePoint
Online Training On SharePoint |
Friday, 22 May 2009
Test for SharePoint Developer
I have put a multiple question test for SharePoint Developers. It consist of 20 questions of multiple choice type and check your knowledge on various topics from SharePoint Development perspective. This test will assist you to prepare for SharePoint certifications like 70-541 (Microsoft Windows SharePoint Services 3.0 – Application Development) and 70-542 (Microsoft Office SharePoint Server 2007 – Application Development). Take the test at:
Developer Test on SharePoint
Developer Test on SharePoint
Wednesday, 20 May 2009
Error while inserting the data in SharePoint list through WebServices
I was working on a requirement where we need to insert huge amount of data (more than 2500 records) in SharePoint list using WebServices. For this purpose a we were creating CAML query dynamically which was doing this task. Earlier when the number of record which needs to be inserted were less approach was working fine without error. But when we tried with 2500 records it started failing with the following message
"Unexpected Failure: Entire batch aborted, no items affected. Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown."
This error occours if the size of the CAML Query increases beyond a point. To fix this issue I started sending the data in small chunk so the size of CAML query created is small. This has fixed this issue.
"Unexpected Failure: Entire batch aborted, no items affected. Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown."
This error occours if the size of the CAML Query increases beyond a point. To fix this issue I started sending the data in small chunk so the size of CAML query created is small. This has fixed this issue.
Sunday, 17 May 2009
Expiration Information Management Policy Disabled in SharePoint List
Recently I had a requirement to delete the items in a list after a specified amount of time automatically. I thought to set up a Expiration Information Management Policy on a list to do this automatically. With the Expiration Information Management Policy I can delete/move the items from list after a specified period of time or can trigger a workflow if I want to move them in some archival list.
When I navigated to Settings -- List Settings -- Permission and Management -- Information Management Policy Setting, and selected the Expiration policy it was disabled.
In my list there was no column defined having data type as Date. Then I created a column in the list with the information type as Date. Once this column is create the retention period policy is enabled.
When I navigated to Settings -- List Settings -- Permission and Management -- Information Management Policy Setting, and selected the Expiration policy it was disabled.
In my list there was no column defined having data type as Date. Then I created a column in the list with the information type as Date. Once this column is create the retention period policy is enabled.
Monday, 4 May 2009
Different approaches of deleting Data from SharePoint List using SharePoint Object Model
Recently while I was was working with SharePoint Object Model to delete data from SharePoint List I observed that the data was deleting permanently and was not going to Recycle Bin. We were using the following code:
using (SPSite siteCollection = new SPSite("http://localhost"))
{
using (SPWeb site = siteCollection.OpenWeb())
{
SPList list1 = site.Lists["TestList"];
for (int i = list1.Items.Count - 1; i >= 0; i--)
{
list1.Items.Delete(i);
}
}
}
The method deletes the data permanently from the SharePoint and it does not send the data to Recycle Bin.
So upon doing little search I found Recycle method of SPListItem Class. This method will delete the data from the list and send the data to the Recycle Bin.
So to delete the data with SharePoint Object Model from a SharePoint List so that the deleted data goes to Recycle Bin use the following code:
using (SPSite siteCollection = new SPSite("http://localhost"))
{
using (SPWeb site = siteCollection.OpenWeb())
{
SPList list1 = site.Lists["TestList"];
for (int i = list11.Items.Count - 1; i >= 0; i--)
{
SPListItem olistitem = list11.Items[i];
olistitem.Recycle();
}
}
}
using (SPSite siteCollection = new SPSite("http://localhost"))
{
using (SPWeb site = siteCollection.OpenWeb())
{
SPList list1 = site.Lists["TestList"];
for (int i = list1.Items.Count - 1; i >= 0; i--)
{
list1.Items.Delete(i);
}
}
}
The method deletes the data permanently from the SharePoint and it does not send the data to Recycle Bin.
So upon doing little search I found Recycle method of SPListItem Class. This method will delete the data from the list and send the data to the Recycle Bin.
So to delete the data with SharePoint Object Model from a SharePoint List so that the deleted data goes to Recycle Bin use the following code:
using (SPSite siteCollection = new SPSite("http://localhost"))
{
using (SPWeb site = siteCollection.OpenWeb())
{
SPList list1 = site.Lists["TestList"];
for (int i = list11.Items.Count - 1; i >= 0; i--)
{
SPListItem olistitem = list11.Items[i];
olistitem.Recycle();
}
}
}
Friday, 1 May 2009
Accessing Server Variables in the Data View Web Part
We had a requirement where we need to show the Server Name and the Logged In user name through a Data View Web Part in a SharePoint Page.
For this purpose we can use ServerVariables in the Data View Web Part. We can create new parameters from Common Data View Task as shown in the screen shot:
Give a proper name to the Parameter and then specify which Server Variable we want to access with this. Once we do this this Server Variable will be assigned to this parameter. In my case I have created two variables with SERVER_NAME and LOGON_USER
Once this is done these variable can accessed from XSLT using the code:
<xsl:value-of select="$ServerName"></xsl:value-of>
All the Server Variables list which we can use are found here:
For this purpose we can use ServerVariables in the Data View Web Part. We can create new parameters from Common Data View Task as shown in the screen shot:
Give a proper name to the Parameter and then specify which Server Variable we want to access with this. Once we do this this Server Variable will be assigned to this parameter. In my case I have created two variables with SERVER_NAME and LOGON_USER
Once this is done these variable can accessed from XSLT using the code:
<xsl:value-of select="$ServerName"></xsl:value-of>
All the Server Variables list which we can use are found here:
Subscribe to:
Posts (Atom)