Wednesday, September 12, 2012

Programatically redirect to custom error page

 

 An easy way of redirecting to custom error page in sharePoint.

http://howtosharepoint.blogspot.com/2010/04/how-to-programatically-redirect-to.html

 

 

Thursday, May 17, 2012

How to create SharePoint list instance / List Definition from an existing List

 There are many ways to create a SharePoint list instance/list definitions in your web Part projects.
  1. Manually add List definitions ,list instances and create the solution.
  2. Save the list as a template and manually modify the schema.xml file, from the element.xml file given   by the template.etc
But these solutions involve manual works which can lead to more human errors.
Crating an list instance to your SharePoint project is no longer a difficult task for a developer if your following these steps.

Step 1
Go to you share Point site and create a custom List . in this example I am going to create a list called TestList.

 Step 2
Create the columns as per your need.

Step 3.
Move to the site action - > site settings. under site actions click on save site as template  link.
Note:if your have a publishing site deactivate the following features in order to perform this operations.(Otherwise save site as template link will not appear)
  1. site collection feature
    • SharePoint Server Publishing Infrastructure
  2.  site feature
    • SharePoint Server Publishing
give a name for the template and save the template.If you need the contents from the list tick the Include content check box.

Step 4.
After you save the template you can find the template inside the Solution gallery.
you can move the solution gallery by clicking on the link appears soon after you save the template.
or you can go to site action - >site settings -> under Galleries Solutions 

The saved template appears here.Click on the template(Web service package) and save the template in your local machine.

Step 5.
Move to visual studio project .
File - > Add - > new project select Import share point solution package project from the list.
provide a name ,select a location and save the project.
Alternatively you can open up a new - > project -> Import share point solution package

follow the wizard appears.
  1. Give the share point site name.
  2. Browse the template(Web service package) you have saved in the step 4.
  3. Click finish

Step 6.
Open up the project you have created in the windows Explorer.
Inside the List Instances folder you can find the list instance you have created.



Step 7
Now you can add this list instance to your project .
Create a folder named as List Instance in you project
Copy the list instance into your project by open up your project in the in the Windows explorer.

Now you can include this list instance to to the project by click on the Show all files - >Include in project


Step 8.
Now you have added the list to your site.But in order to include this list with the deployment .You have to create a New feature and add the list instances and the modules.







Friday, March 23, 2012

How to restore an existing SharePoint list to your website.(Share point 2010)
If you wish to take a back of your existing SharePoint list and need to restore it to another SharePoint website or to use within a sub site in you existing site. here are the steps to follow.
 1.Go to the Existing List (e.g. ContactUs List)
2.Select List Settings 
3.Select Save List as template
 provide a suitable name for the template.



Select the Include contents check box if you wish to save the content with the template.

You can find this saved template on SiteActions -- > Settings -- > List templates under you root site.

If you wanted to back up this into a new site

1.Go to SiteActions -- > Settings -- > List templates and select the saved template and click "download a copy" in the ribbon.

2.Go the the site you wish to restore this List
3. Move to SiteActions -- > Settings -- > List templates 
4. Click the "Document" tab and select "Upload a docuement" browse the downloaded template and add it in to the List templates library.


Now you can use the template 


move to site action -- > more item 
select List now you'll find the saved list in the list templates.




add the list to the required sites.Enjoy.. :)


Saturday, February 18, 2012

How to programmatically  control the Logitech Orbit Camera  using C++,VC++

Today I am going to share my knowledge on how to control the Logitech Orbit camera using C++.

This camera has the feature of turning pan-Horizontal movement,Tilt-Vertical Movement and Zoom up to 4X.
When we are building applications where we need to manually control the motion of the camera,we can't use the software provided by Logitech.Instead we need to write our own peace of code to control this.

I think it's better to discuss about only one function of this code for the readers to get a good understanding about the code 



//This method is used to control the rotation of the camera.
void Cameramen::RotateCamera(long valueX,long valueY,long z)
{   
enum_devices("Pan",valueX,0);
enum_devices("Tilt",valueY,0);
enum_devices("Zoom",0,z);
}

This peace of code is used to control all the movements of the camera.I'll describe how.
What is the actual work needed to be done by the programmer is to call this method with the required values for the rotation.

 valueX is the Pan value-Positive numbers to turn the camera into right and negative number to turn the camera to the left.
valueY is the Tilt value-Positive numbers to turn the camera upwards and negative  number to turn the camera downwards.
z is for zoom- value 100 would be the least zoom ,value 400 would be the maximum zoom and Values in between will result in different zoom levels.


Thursday, February 16, 2012

How to integrate Sharepoint dispose checker into Visual Studio 2010

The first thing you have to do is .Install the spdisposechecker into your machine. You can download the the spDisposeChecker here

Follow the steps for the installation 
1. Run the SPDisposeCheck.msi
2.Click Next

3.Select I agree for the licence agreement click Next.


4.Select the Install Visual studio addin -leave this as blank if you wanted to run as command line tool .Even  if you untick this, you can add the addin to the Visual studio, we will discuss that later.
Tick the Excecute spDisposeCheck if you wanted to run the tool soon after the installation

5.Select an Installation path -note the installation location, this will be used if you didn't tick the install visual studio addin in the previous step.
Click Next


6.Click Close to finish the installation


7.Restart Visual studio -You will find the spDisposeCheck under tools. 

If you havent tick the check Install Visual studio addin follow the steps to add the spDisposeCheck tool to visual studio.

1.Go to Tools -> External tools 
2.Click Add
3.Fill the fields according to the bellow image.

Select the spDisposeCheck installation location for the command textbox.


Run the spDisposeChecke tool to check for any memory leaks this will provide the result in to the output window


·         SPDisposeCheckID_170 It is NOT necessary to dispose the SPWeb object returned by SPWeb.ParentWeb. The dispose cleanup is handled automatically by the SharePoint framework.

·         SPDisposeCheckID_140 It is NOT necessary to dispose the SPWeb object returned by SPWeb.RootWeb. The dispose cleanup is handled automatically by the SharePoint framework.

·         SPDisposeCheckID_220 It is NOT necessary to dispose SPContext objects on your code, since they are managed by the SharePoint framework.

·         SPDisposeCheckID_210 It is NOT necessary to dispose SPContext object returned from calling SPControl.GetContextSite and SPControl.GetContextWeb Methods, since they are managed by the SharePoint framework.

Note: This tool may report errors which are not actually memory leaks, otherwise known as false positives.
Further investigation should be done to identify and correct real errors.
It is designed to assist developers in making sure their code adheres to best practices for memory allocation when using SharePoint APIs.
Please see the following for more information:
http://blogs.msdn.com/rogerla/
http://msdn2.microsoft.com/en-us/library/aa973248.aspx
http://msdn2.microsoft.com/en-us/library/bb687949.aspx